Changeset 67f55e7b in mainline


Ignore:
Timestamp:
2011-10-31T15:51:49Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b17e37
Parents:
0cd8089
Message:

usb: Allow devices to request explicit address.

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hc_iface.c

    r0cd8089 r67f55e7b  
    5656 * @return Error code.
    5757 */
    58 static int request_address(ddf_fun_t *fun, usb_speed_t speed,
    59     usb_address_t *address)
     58static int request_address(ddf_fun_t *fun, usb_address_t *address, bool strict,
     59    usb_speed_t speed)
    6060{
    6161        UNSUPPORTED("request_address");
  • uspace/drv/bus/usb/vhc/connhost.c

    r0cd8089 r67f55e7b  
    5757 * @return Error code.
    5858 */
    59 static int request_address(ddf_fun_t *fun, usb_speed_t speed,
    60     usb_address_t *address)
    61 {
    62         VHC_DATA(vhc, fun);
    63 
    64         usb_address_t addr = 1;
    65         const int ret = usb_device_manager_request_address(
    66             &vhc->dev_manager, &addr, false, USB_SPEED_HIGH);
    67         if (ret < 0) {
    68                 return ret;
    69         }
    70 
    71         if (address != NULL) {
    72                 *address = addr;
    73         }
    74 
    75         return EOK;
     59static int request_address(ddf_fun_t *fun, usb_address_t *address, bool strict,
     60    usb_speed_t speed)
     61{
     62        VHC_DATA(vhc, fun);
     63
     64        assert(address);
     65        return usb_device_manager_request_address(
     66            &vhc->dev_manager, address, strict, speed);
    7667}
    7768
  • uspace/lib/drv/generic/remote_usbhc.c

    r0cd8089 r67f55e7b  
    118118        }
    119119
    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);
    124125        if (rc != EOK) {
    125126                async_answer_0(callid, rc);
  • uspace/lib/drv/include/usbhc_iface.h

    r0cd8089 r67f55e7b  
    170170/** USB host controller communication interface. */
    171171typedef 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);
    173173        int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t);
    174174        int (*find_by_address)(ddf_fun_t *, usb_address_t, devman_handle_t *);
  • uspace/lib/usbdev/include/usb/dev/hub.h

    r0cd8089 r67f55e7b  
    5959} usb_hub_attached_device_t;
    6060
    61 usb_address_t usb_hc_request_address(usb_hc_connection_t *, usb_speed_t);
     61usb_address_t usb_hc_request_address(usb_hc_connection_t *, usb_address_t,
     62    bool, usb_speed_t);
    6263int usb_hc_register_device(usb_hc_connection_t *,
    6364    const usb_hub_attached_device_t *);
  • uspace/lib/usbdev/src/hub.c

    r0cd8089 r67f55e7b  
    6666 *
    6767 * @param connection Opened connection to host controller.
     68 * @param preferred Preferred SUB address.
     69 * @param strict Fail if the preferred address is not avialable.
    6870 * @param speed Speed of the new device (device that will be assigned
    6971 *    the returned address).
     
    7173 */
    7274usb_address_t usb_hc_request_address(usb_hc_connection_t *connection,
    73     usb_speed_t speed)
     75    usb_address_t preferred, bool strict, usb_speed_t speed)
    7476{
    7577        CHECK_CONNECTION(connection);
     
    7880       
    7981        sysarg_t address;
    80         int rc = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    81             IPC_M_USBHC_REQUEST_ADDRESS, speed,
    82             &address);
     82        int rc = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     83            IPC_M_USBHC_REQUEST_ADDRESS, preferred, strict, speed, &address);
    8384       
    8485        async_exchange_end(exch);
     
    223224         * Request new address.
    224225         */
    225         usb_address_t dev_addr = usb_hc_request_address(&hc_conn, dev_speed);
     226        usb_address_t dev_addr =
     227            usb_hc_request_address(&hc_conn, 1, false, dev_speed);
    226228        if (dev_addr < 0) {
    227229                rc = EADDRNOTAVAIL;
  • uspace/lib/usbhost/src/iface.c

    r0cd8089 r67f55e7b  
    9797 */
    9898static int request_address(
    99     ddf_fun_t *fun, usb_speed_t speed, usb_address_t *address)
     99    ddf_fun_t *fun, usb_address_t *address, bool strict, usb_speed_t speed)
    100100{
    101101        assert(fun);
     
    106106        usb_log_debug("Address request speed: %s.\n", usb_str_speed(speed));
    107107        return usb_device_manager_request_address(
    108             &hcd->dev_manager, address, false, speed);
     108            &hcd->dev_manager, address, strict, speed);
    109109}
    110110/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.