Ignore:
Timestamp:
2018-01-16T19:22:58Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4603b35
Parents:
47e9494
Message:

usb: speed moved from default address reservation to enumeration callback

File:
1 edited

Legend:

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

    r47e9494 reeca8a6  
    5757/** Reserve default USB address.
    5858 * @param[in] exch IPC communication exchange
     59 * @return Error code.
     60 */
     61int usbhc_reserve_default_address(async_exch_t *exch)
     62{
     63        if (!exch)
     64                return EBADMEM;
     65        return async_req_1_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USB_RESERVE_DEFAULT_ADDRESS);
     66}
     67
     68/** Release default USB address.
     69 *
     70 * @param[in] exch IPC communication exchange
     71 *
     72 * @return Error code.
     73 */
     74int usbhc_release_default_address(async_exch_t *exch)
     75{
     76        if (!exch)
     77                return EBADMEM;
     78        return async_req_1_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USB_RELEASE_DEFAULT_ADDRESS);
     79}
     80
     81/**
     82 * Trigger USB device enumeration
     83 *
     84 * @param[in] exch IPC communication exchange
     85 * @param[in] port Port number at which the device is attached
    5986 * @param[in] speed Communication speed of the newly attached device
     87 *
    6088 * @return Error code.
    6189 */
    62 int usbhc_reserve_default_address(async_exch_t *exch, usb_speed_t speed)
    63 {
    64         if (!exch)
    65                 return EBADMEM;
    66         return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    67             IPC_M_USB_RESERVE_DEFAULT_ADDRESS, speed);
    68 }
    69 
    70 /** Release default USB address.
    71  *
    72  * @param[in] exch IPC communication exchange
    73  *
    74  * @return Error code.
    75  *
    76  */
    77 int usbhc_release_default_address(async_exch_t *exch)
    78 {
    79         if (!exch)
    80                 return EBADMEM;
    81         return async_req_1_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    82             IPC_M_USB_RELEASE_DEFAULT_ADDRESS);
    83 }
    84 
    85 /** Trigger USB device enumeration
    86  *
    87  * @param[in]  exch   IPC communication exchange
    88  * @param[out] handle Identifier of the newly added device (if successful)
    89  *
    90  * @return Error code.
    91  *
    92  */
    93 int usbhc_device_enumerate(async_exch_t *exch, unsigned port)
    94 {
    95         if (!exch)
    96                 return EBADMEM;
    97         const int ret = async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    98             IPC_M_USB_DEVICE_ENUMERATE, port);
     90int usbhc_device_enumerate(async_exch_t *exch, unsigned port, usb_speed_t speed)
     91{
     92        if (!exch)
     93                return EBADMEM;
     94        const int ret = async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     95            IPC_M_USB_DEVICE_ENUMERATE, port, speed);
    9996        return ret;
    10097}
     
    310307        }
    311308
    312         usb_speed_t speed = DEV_IPC_GET_ARG1(*call);
    313         const int ret = usbhc_iface->reserve_default_address(fun, speed);
     309        const int ret = usbhc_iface->reserve_default_address(fun);
    314310        async_answer_0(callid, ret);
    315311}
     
    340336
    341337        const unsigned port = DEV_IPC_GET_ARG1(*call);
    342         const int ret = usbhc_iface->device_enumerate(fun, port);
     338        usb_speed_t speed = DEV_IPC_GET_ARG2(*call);
     339        const int ret = usbhc_iface->device_enumerate(fun, port, speed);
    343340        async_answer_0(callid, ret);
    344341}
Note: See TracChangeset for help on using the changeset viewer.