Changeset 27736cf in mainline


Ignore:
Timestamp:
2011-10-31T16:50:31Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
07a7a97d
Parents:
f37eb84
Message:

usb: Don't pass speed info when registering endpoint.

Location:
uspace
Files:
7 edited

Legend:

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

    rf37eb84 r27736cf  
    120120 */
    121121static int register_endpoint(ddf_fun_t *fun,
    122     usb_address_t address, usb_speed_t speed, usb_endpoint_t endpoint,
     122    usb_address_t address, usb_endpoint_t endpoint,
    123123    usb_transfer_type_t transfer_type, usb_direction_t direction,
    124124    size_t max_packet_size, unsigned int interval)
  • uspace/drv/bus/usb/vhc/connhost.c

    rf37eb84 r27736cf  
    128128 */
    129129static int register_endpoint(ddf_fun_t *fun,
    130     usb_address_t address, usb_speed_t speed, usb_endpoint_t endpoint,
     130    usb_address_t address, usb_endpoint_t endpoint,
    131131    usb_transfer_type_t transfer_type, usb_direction_t direction,
    132132    size_t max_packet_size, unsigned int interval)
  • uspace/lib/drv/generic/remote_usbhc.c

    rf37eb84 r27736cf  
    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,
     
    234234
    235235#define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \
    236         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
     236        type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) >> 16)
    237237#define _INIT_FROM_LOW_DATA2(type, var, arg_no) \
    238         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 16)
    239 #define _INIT_FROM_HIGH_DATA3(type, var, arg_no) \
    240         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
    241 #define _INIT_FROM_MIDDLE_DATA3(type, var, arg_no) \
    242         type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) / (1 << 8)) % (1 << 8)
    243 #define _INIT_FROM_LOW_DATA3(type, var, arg_no) \
    244         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8)
     238        type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) & 0xffff)
    245239
    246240        const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) };
    247241
    248         _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2);
    249         _INIT_FROM_MIDDLE_DATA3(usb_transfer_type_t, transfer_type, 2);
    250         _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);
    251244
    252245        _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3);
     
    255248#undef _INIT_FROM_HIGH_DATA2
    256249#undef _INIT_FROM_LOW_DATA2
    257 #undef _INIT_FROM_HIGH_DATA3
    258 #undef _INIT_FROM_MIDDLE_DATA3
    259 #undef _INIT_FROM_LOW_DATA3
    260 
    261         int rc = usb_iface->register_endpoint(fun, target.address, speed,
     250
     251        int rc = usb_iface->register_endpoint(fun, target.address,
    262252            target.endpoint, transfer_type, direction, max_packet_size, interval);
    263253
  • uspace/lib/drv/include/usbhc_iface.h

    rf37eb84 r27736cf  
    176176
    177177        int (*register_endpoint)(ddf_fun_t *,
    178             usb_address_t, usb_speed_t, usb_endpoint_t,
     178            usb_address_t, usb_endpoint_t,
    179179            usb_transfer_type_t, usb_direction_t, size_t, unsigned int);
    180180        int (*unregister_endpoint)(ddf_fun_t *, usb_address_t, usb_endpoint_t,
  • uspace/lib/usbdev/include/usb/dev/pipes.h

    rf37eb84 r27736cf  
    172172int usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
    173173    size_t, const uint8_t *, size_t, usb_device_connection_t *);
    174 int usb_pipe_register_with_speed(usb_pipe_t *, usb_speed_t,
    175     unsigned int, usb_hc_connection_t *);
    176174int usb_pipe_register(usb_pipe_t *, unsigned int, usb_hc_connection_t *);
    177175int usb_pipe_unregister(usb_pipe_t *, usb_hc_connection_t *);
  • uspace/lib/usbdev/src/pipesinit.c

    rf37eb84 r27736cf  
    454454 * @return Error code.
    455455 */
    456 int usb_pipe_register(usb_pipe_t *pipe,
    457     unsigned int interval,
    458     usb_hc_connection_t *hc_connection)
    459 {
    460         return usb_pipe_register_with_speed(pipe, USB_SPEED_MAX + 1,
    461             interval, hc_connection);
    462 }
    463 
    464 /** Register endpoint with a speed at the host controller.
    465  *
    466  * You will rarely need to use this function because it is needed only
    467  * if the registered endpoint is of address 0 and there is no other way
    468  * to tell speed of the device at address 0.
    469  *
    470  * @param pipe Pipe to be registered.
    471  * @param speed Speed of the device
    472  *      (invalid speed means use previously specified one).
    473  * @param interval Polling interval.
    474  * @param hc_connection Connection to the host controller (must be opened).
    475  * @return Error code.
    476  */
    477 int usb_pipe_register_with_speed(usb_pipe_t *pipe, usb_speed_t speed,
    478     unsigned int interval,
     456int usb_pipe_register(usb_pipe_t *pipe, unsigned interval,
    479457    usb_hc_connection_t *hc_connection)
    480458{
    481459        assert(pipe);
    482460        assert(hc_connection);
    483        
     461
    484462        if (!usb_hc_connection_is_opened(hc_connection))
    485463                return EBADF;
    486        
     464
    487465        const usb_target_t target =
    488466            {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};
    489 #define _PACK2(high, low) (((high) << 16) + (low))
    490 #define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low))
    491        
     467#define _PACK2(high, low) (((high & 0xffff) << 16) | (low & 0xffff))
     468
    492469        async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess);
    493470        int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    494471            IPC_M_USBHC_REGISTER_ENDPOINT, target.packed,
    495             _PACK3(speed, pipe->transfer_type, pipe->direction),
     472            _PACK2(pipe->transfer_type, pipe->direction),
    496473            _PACK2(pipe->max_packet_size, interval));
    497474        async_exchange_end(exch);
    498        
     475
    499476#undef _PACK2
    500 #undef _PACK3
    501        
    502477        return rc;
    503478}
  • uspace/lib/usbhost/src/iface.c

    rf37eb84 r27736cf  
    182182/*----------------------------------------------------------------------------*/
    183183static int register_endpoint(
    184     ddf_fun_t *fun, usb_address_t address, usb_speed_t ep_speed,
    185     usb_endpoint_t endpoint,
     184    ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint,
    186185    usb_transfer_type_t transfer_type, usb_direction_t direction,
    187186    size_t max_packet_size, unsigned int interval)
Note: See TracChangeset for help on using the changeset viewer.