Ignore:
Timestamp:
2013-01-15T21:50:52Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0f4bff8
Parents:
ef4e8eb
Message:

usb: Drop deprecated usb hc interface functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhc.c

    ref4e8eb ref40434  
    8484 */
    8585typedef enum {
    86         /** Asks for address assignment by host controller.
    87          * Answer:
    88          * - ELIMIT - host controller run out of address
    89          * - EOK - address assigned
    90          * Answer arguments:
    91          * - assigned address
    92          *
    93          * The address must be released by via IPC_M_USBHC_RELEASE_ADDRESS.
    94          */
    95         IPC_M_USBHC_REQUEST_ADDRESS,
    96 
    97         /** Bind USB address with devman handle.
    98          * Parameters:
    99          * - USB address
    100          * - devman handle
    101          * Answer:
    102          * - EOK - address binded
    103          * - ENOENT - address is not in use
    104          */
    105         IPC_M_USBHC_BIND_ADDRESS,
    106 
    10786        /** Get handle binded with given USB address.
    10887         * Parameters
     
    11392         */
    11493        IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,
    115 
    116         /** Release address in use.
    117          * Arguments:
    118          * - address to be released
    119          * Answer:
    120          * - ENOENT - address not in use
    121          * - EPERM - trying to release default USB address
    122          */
    123         IPC_M_USBHC_RELEASE_ADDRESS,
    12494
    12595        /** Register endpoint attributes at host controller.
     
    161131} usbhc_iface_funcs_t;
    162132
    163 int usbhc_request_address(async_exch_t *exch, usb_address_t *address,
    164     bool strict, usb_speed_t speed)
    165 {
    166         if (!exch || !address)
    167                 return EBADMEM;
    168         sysarg_t new_address;
    169         const int ret = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    170             IPC_M_USBHC_REQUEST_ADDRESS, *address, strict, speed, &new_address);
    171         if (ret == EOK)
    172                 *address = (usb_address_t)new_address;
    173         return ret;
    174 }
    175 
    176 int usbhc_bind_address(async_exch_t *exch, usb_address_t address,
    177     devman_handle_t handle)
    178 {
    179         if (!exch)
    180                 return EBADMEM;
    181         return async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    182             IPC_M_USBHC_BIND_ADDRESS, address, handle);
    183 }
     133
    184134
    185135int usbhc_get_handle(async_exch_t *exch, usb_address_t address,
     
    196146}
    197147
    198 int usbhc_release_address(async_exch_t *exch, usb_address_t address)
    199 {
    200         if (!exch)
    201                 return EBADMEM;
    202         return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    203             IPC_M_USBHC_RELEASE_ADDRESS, address);
    204 }
    205 
    206148int usbhc_register_endpoint(async_exch_t *exch, usb_address_t address,
    207149    usb_endpoint_t endpoint, usb_transfer_type_t type,
     
    323265
    324266
    325 static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    326 static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    327267static void remote_usbhc_get_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    328 static void remote_usbhc_release_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    329268static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    330269static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    335274/** Remote USB host controller interface operations. */
    336275static remote_iface_func_ptr_t remote_usbhc_iface_ops[] = {
    337         [IPC_M_USBHC_REQUEST_ADDRESS] = remote_usbhc_request_address,
    338         [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address,
    339         [IPC_M_USBHC_BIND_ADDRESS] = remote_usbhc_bind_address,
    340276        [IPC_M_USBHC_GET_HANDLE_BY_ADDRESS] = remote_usbhc_get_handle,
    341277
     
    387323}
    388324
    389 void remote_usbhc_request_address(ddf_fun_t *fun, void *iface,
    390     ipc_callid_t callid, ipc_call_t *call)
    391 {
    392         const usbhc_iface_t *usb_iface = iface;
    393 
    394         if (!usb_iface->request_address) {
    395                 async_answer_0(callid, ENOTSUP);
    396                 return;
    397         }
    398 
    399         usb_address_t address = DEV_IPC_GET_ARG1(*call);
    400         const bool strict = DEV_IPC_GET_ARG2(*call);
    401         const usb_speed_t speed = DEV_IPC_GET_ARG3(*call);
    402 
    403         const int rc = usb_iface->request_address(fun, &address, strict, speed);
    404         if (rc != EOK) {
    405                 async_answer_0(callid, rc);
    406         } else {
    407                 async_answer_1(callid, EOK, (sysarg_t) address);
    408         }
    409 }
    410 
    411 void remote_usbhc_bind_address(ddf_fun_t *fun, void *iface,
    412     ipc_callid_t callid, ipc_call_t *call)
    413 {
    414         const usbhc_iface_t *usb_iface = iface;
    415 
    416         if (!usb_iface->bind_address) {
    417                 async_answer_0(callid, ENOTSUP);
    418                 return;
    419         }
    420 
    421         const usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
    422         const devman_handle_t handle = (devman_handle_t) DEV_IPC_GET_ARG2(*call);
    423 
    424         const int ret = usb_iface->bind_address(fun, address, handle);
    425         async_answer_0(callid, ret);
    426 }
    427325
    428326void remote_usbhc_get_handle(ddf_fun_t *fun, void *iface,
     
    447345}
    448346
    449 void remote_usbhc_release_address(ddf_fun_t *fun, void *iface,
    450     ipc_callid_t callid, ipc_call_t *call)
    451 {
    452         const usbhc_iface_t *usb_iface = iface;
    453 
    454         if (!usb_iface->release_address) {
    455                 async_answer_0(callid, ENOTSUP);
    456                 return;
    457         }
    458 
    459         const usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
    460 
    461         const int ret = usb_iface->release_address(fun, address);
    462         async_answer_0(callid, ret);
    463 }
    464347
    465348static void callback_out(int outcome, void *arg)
Note: See TracChangeset for help on using the changeset viewer.