Ignore:
Timestamp:
2011-04-08T22:25:00Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
98064795
Parents:
297341b
Message:

Endpoint registration sends address as well

This is the first step towards using endpoint registration instead
of reservation of default address.

File:
1 edited

Legend:

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

    r297341b r1998bcd  
    533533        }
    534534
    535 #define INIT_FROM_HIGH_DATA(type, var, arg_no) \
    536         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / 256
    537 #define INIT_FROM_LOW_DATA(type, var, arg_no) \
    538         type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % 256
    539 
    540         INIT_FROM_HIGH_DATA(usb_address_t, address, 1);
    541         INIT_FROM_LOW_DATA(usb_endpoint_t, endpoint, 1);
    542         INIT_FROM_HIGH_DATA(usb_transfer_type_t, transfer_type, 2);
    543         INIT_FROM_LOW_DATA(usb_direction_t, direction, 2);
    544 
    545 #undef INIT_FROM_HIGH_DATA
    546 #undef INIT_FROM_LOW_DATA
    547 
    548         size_t max_packet_size = (size_t) DEV_IPC_GET_ARG3(*call);
    549         unsigned int interval  = (unsigned int) DEV_IPC_GET_ARG4(*call);
    550 
    551         int rc = usb_iface->register_endpoint(fun, address, endpoint,
     535#define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \
     536        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
     537#define _INIT_FROM_LOW_DATA2(type, var, arg_no) \
     538        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 16)
     539#define _INIT_FROM_HIGH_DATA3(type, var, arg_no) \
     540        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16)
     541#define _INIT_FROM_MIDDLE_DATA3(type, var, arg_no) \
     542        type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) / (1 << 8)) % (1 << 8)
     543#define _INIT_FROM_LOW_DATA3(type, var, arg_no) \
     544        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8)
     545
     546        _INIT_FROM_HIGH_DATA2(usb_address_t, address, 1);
     547        _INIT_FROM_LOW_DATA2(usb_endpoint_t, endpoint, 1);
     548
     549        _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2);
     550        _INIT_FROM_MIDDLE_DATA3(usb_transfer_type_t, transfer_type, 2);
     551        _INIT_FROM_LOW_DATA3(usb_direction_t, direction, 2);
     552
     553        _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3);
     554        _INIT_FROM_LOW_DATA2(unsigned int, interval, 3);
     555
     556#undef _INIT_FROM_HIGH_DATA2
     557#undef _INIT_FROM_LOW_DATA2
     558#undef _INIT_FROM_HIGH_DATA3
     559#undef _INIT_FROM_MIDDLE_DATA3
     560#undef _INIT_FROM_LOW_DATA3
     561
     562        int rc = usb_iface->register_endpoint(fun, address, speed, endpoint,
    552563            transfer_type, direction, max_packet_size, interval);
    553564
Note: See TracChangeset for help on using the changeset viewer.