Changeset 5514cf7 in mainline


Ignore:
Timestamp:
2013-08-07T09:16:57Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3121b5f
Parents:
4b8ecff
Message:

libdrv: Remove old hc handle based functions

Location:
uspace/lib/drv
Files:
2 edited

Legend:

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

    r4b8ecff r5514cf7  
    6464
    6565typedef enum {
    66         IPC_M_USB_GET_MY_ADDRESS,
    6766        IPC_M_USB_GET_MY_INTERFACE,
    68         IPC_M_USB_GET_HOST_CONTROLLER_HANDLE,
    6967        IPC_M_USB_GET_DEVICE_HANDLE,
    7068        IPC_M_USB_RESERVE_DEFAULT_ADDRESS,
     
    7876} usb_iface_funcs_t;
    7977
    80 /** Tell USB address assigned to device.
    81  * @param exch Vaid IPC exchange
    82  * @param address Pointer to address storage place.
    83  * @return Error code.
    84  *
    85  * Exch param is an open communication to device implementing usb_iface.
    86  */
    87 int usb_get_my_address(async_exch_t *exch, usb_address_t *address)
    88 {
    89         sysarg_t addr;
    90         const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    91             IPC_M_USB_GET_MY_ADDRESS, &addr);
    92 
    93         if (ret == EOK && address != NULL)
    94                 *address = (usb_address_t) addr;
    95         return ret;
    96 }
    97 
    9878/** Tell interface number given device can use.
    9979 * @param[in] exch IPC communication exchange
     
    11191        if (ret == EOK && usb_iface)
    11292                *usb_iface = (int)iface_no;
    113         return ret;
    114 }
    115 
    116 /** Tell devman handle of device host controller.
    117  * @param[in] exch IPC communication exchange
    118  * @param[out] hc_handle devman handle of the HC used by the target device.
    119  * @return Error code.
    120  */
    121 int usb_get_hc_handle(async_exch_t *exch, devman_handle_t *hc_handle)
    122 {
    123         if (!exch)
    124                 return EBADMEM;
    125         devman_handle_t h;
    126         const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    127             IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h);
    128         if (ret == EOK && hc_handle)
    129                 *hc_handle = (devman_handle_t)h;
    13093        return ret;
    13194}
     
    309272}
    310273
    311 static void remote_usb_get_my_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    312274static void remote_usb_get_my_interface(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    313 static void remote_usb_get_hc_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    314275static void remote_usb_get_device_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    315 
    316276static void remote_usb_reserve_default_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    317277static void remote_usb_release_default_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    321281static void remote_usb_unregister_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    322282static void remote_usb_read(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call);
    323 
    324283static void remote_usb_write(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call);
    325284
    326285/** Remote USB interface operations. */
    327286static remote_iface_func_ptr_t remote_usb_iface_ops [] = {
    328         [IPC_M_USB_GET_MY_ADDRESS] = remote_usb_get_my_address,
    329287        [IPC_M_USB_GET_MY_INTERFACE] = remote_usb_get_my_interface,
    330         [IPC_M_USB_GET_HOST_CONTROLLER_HANDLE] = remote_usb_get_hc_handle,
    331288        [IPC_M_USB_GET_DEVICE_HANDLE] = remote_usb_get_device_handle,
    332289        [IPC_M_USB_RESERVE_DEFAULT_ADDRESS] = remote_usb_reserve_default_address,
     
    347304};
    348305
    349 
    350 void remote_usb_get_my_address(ddf_fun_t *fun, void *iface,
    351     ipc_callid_t callid, ipc_call_t *call)
    352 {
    353         const usb_iface_t *usb_iface = (usb_iface_t *) iface;
    354 
    355         if (usb_iface->get_my_address == NULL) {
    356                 async_answer_0(callid, ENOTSUP);
    357                 return;
    358         }
    359 
    360         usb_address_t address;
    361         const int ret = usb_iface->get_my_address(fun, &address);
    362         if (ret != EOK) {
    363                 async_answer_0(callid, ret);
    364         } else {
    365                 async_answer_1(callid, EOK, address);
    366         }
    367 }
    368 
    369306void remote_usb_get_my_interface(ddf_fun_t *fun, void *iface,
    370307    ipc_callid_t callid, ipc_call_t *call)
     
    386323}
    387324
    388 void remote_usb_get_hc_handle(ddf_fun_t *fun, void *iface,
    389     ipc_callid_t callid, ipc_call_t *call)
    390 {
    391         const usb_iface_t *usb_iface = (usb_iface_t *) iface;
    392 
    393         if (usb_iface->get_hc_handle == NULL) {
    394                 async_answer_0(callid, ENOTSUP);
    395                 return;
    396         }
    397 
    398         devman_handle_t handle;
    399         const int ret = usb_iface->get_hc_handle(fun, &handle);
    400         if (ret != EOK) {
    401                 async_answer_0(callid, ret);
    402         }
    403 
    404         async_answer_1(callid, EOK, (sysarg_t) handle);
    405 }
    406 
    407325void remote_usb_get_device_handle(ddf_fun_t *fun, void *iface,
    408326    ipc_callid_t callid, ipc_call_t *call)
  • uspace/lib/drv/include/usb_iface.h

    r4b8ecff r5514cf7  
    5252void usb_dev_disconnect(usb_dev_session_t *);
    5353
    54 int usb_get_my_address(async_exch_t *, usb_address_t *);
    5554int usb_get_my_interface(async_exch_t *, int *);
    56 int usb_get_hc_handle(async_exch_t *, devman_handle_t *);
    5755int usb_get_device_handle(async_exch_t *, devman_handle_t *);
    5856
     
    7775/** USB device communication interface. */
    7876typedef struct {
    79         int (*get_my_address)(ddf_fun_t *, usb_address_t *);
    8077        int (*get_my_interface)(ddf_fun_t *, int *);
    81         int (*get_hc_handle)(ddf_fun_t *, devman_handle_t *);
    82 
    8378        int (*get_device_handle)(ddf_fun_t *, devman_handle_t *);
    8479
    8580        int (*reserve_default_address)(ddf_fun_t *, usb_speed_t);
    8681        int (*release_default_address)(ddf_fun_t *);
     82
    8783        int (*device_enumerate)(ddf_fun_t *, usb_device_handle_t *);
    8884        int (*device_remove)(ddf_fun_t *, usb_device_handle_t);
     85
    8986        int (*register_endpoint)(ddf_fun_t *, usb_endpoint_t,
    9087            usb_transfer_type_t, usb_direction_t, size_t, unsigned);
    9188        int (*unregister_endpoint)(ddf_fun_t *, usb_endpoint_t,
    9289            usb_direction_t);
     90
    9391        int (*read)(ddf_fun_t *, usb_endpoint_t, uint64_t, uint8_t *, size_t,
    9492            usbhc_iface_transfer_in_callback_t, void *);
Note: See TracChangeset for help on using the changeset viewer.