Ignore:
Timestamp:
2011-11-10T11:29:10Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
54464f6a, c2245a3, c6f189f7
Parents:
2e1b9dc (diff), 2d1ba51 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge USB changes.

Interface changes:

  • GET_ADDRESS has been renamed to GET_MY_ADDRESS and the handle parameter was dropped. Tis call no longer cascades up to the root hub, but it is answered in the first place the information is available (nearest hub)
  • Reintroduced address reservation for USB_DEFAULT_ADDRESS. The interface now enables device drivers to request specific address on initialization and either insists on that address or accept any other if the address is not available. Note that it is not possible to get the default address if the driver does not insist.
  • Any endpoint registered is removed when address is released and a warning is produced if there were any such endpoints.
  • It is no longer necessary or possible to pass device speed information when registering endpoints.

Driver fixes: memory leaks and crashes (not only) in error paths.
Fixes or removes flaky device_remove implementation in device drivers.

File:
1 edited

Legend:

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

    r2e1b9dc r747ef72  
    5555static remote_iface_func_ptr_t remote_usbhc_iface_ops[] = {
    5656        [IPC_M_USBHC_REQUEST_ADDRESS] = remote_usbhc_request_address,
     57        [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address,
    5758        [IPC_M_USBHC_BIND_ADDRESS] = remote_usbhc_bind_address,
    5859        [IPC_M_USBHC_GET_HANDLE_BY_ADDRESS] = remote_usbhc_find_by_address,
    59         [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address,
    6060
    6161        [IPC_M_USBHC_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint,
     
    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);
     
    233234
    234235#define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \
    235         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
     236        type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) >> 16)
    236237#define _INIT_FROM_LOW_DATA2(type, var, arg_no) \
    237         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 16)
    238 #define _INIT_FROM_HIGH_DATA3(type, var, arg_no) \
    239         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
    240 #define _INIT_FROM_MIDDLE_DATA3(type, var, arg_no) \
    241         type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) / (1 << 8)) % (1 << 8)
    242 #define _INIT_FROM_LOW_DATA3(type, var, arg_no) \
    243         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8)
     238        type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) & 0xffff)
    244239
    245240        const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) };
    246241
    247         _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2);
    248         _INIT_FROM_MIDDLE_DATA3(usb_transfer_type_t, transfer_type, 2);
    249         _INIT_FROM_LOW_DATA3(usb_direction_t, direction, 2);
     242        _INIT_FROM_HIGH_DATA2(usb_transfer_type_t, transfer_type, 2);
     243        _INIT_FROM_LOW_DATA2(usb_direction_t, direction, 2);
    250244
    251245        _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3);
     
    254248#undef _INIT_FROM_HIGH_DATA2
    255249#undef _INIT_FROM_LOW_DATA2
    256 #undef _INIT_FROM_HIGH_DATA3
    257 #undef _INIT_FROM_MIDDLE_DATA3
    258 #undef _INIT_FROM_LOW_DATA3
    259 
    260         int rc = usb_iface->register_endpoint(fun, target.address, speed,
     250
     251        int rc = usb_iface->register_endpoint(fun, target.address,
    261252            target.endpoint, transfer_type, direction, max_packet_size, interval);
    262253
Note: See TracChangeset for help on using the changeset viewer.