Changeset 1998bcd in mainline for uspace/lib/usb/src/pipesinit.c


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/usb/src/pipesinit.c

    r297341b r1998bcd  
    461461    usb_hc_connection_t *hc_connection)
    462462{
     463        return usb_pipe_register_with_speed(pipe, USB_SPEED_MAX + 1,
     464            interval, hc_connection);
     465}
     466
     467/** Register endpoint with a speed at the host controller.
     468 *
     469 * You will rarely need to use this function because it is needed only
     470 * if the registered endpoint is of address 0 and there is no other way
     471 * to tell speed of the device at address 0.
     472 *
     473 * @param pipe Pipe to be registered.
     474 * @param speed Speed of the device
     475 *      (invalid speed means use previously specified one).
     476 * @param interval Polling interval.
     477 * @param hc_connection Connection to the host controller (must be opened).
     478 * @return Error code.
     479 */
     480int usb_pipe_register_with_speed(usb_pipe_t *pipe, usb_speed_t speed,
     481    unsigned int interval,
     482    usb_hc_connection_t *hc_connection)
     483{
    463484        assert(pipe);
    464485        assert(hc_connection);
     
    468489        }
    469490
    470 #define _PACK(high, low) ((high) * 256 + (low))
    471 
    472         return async_req_5_0(hc_connection->hc_phone,
     491#define _PACK2(high, low) (((high) << 16) + (low))
     492#define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low))
     493
     494        return async_req_4_0(hc_connection->hc_phone,
    473495            DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USBHC_REGISTER_ENDPOINT,
    474             _PACK(pipe->wire->address, pipe->endpoint_no),
    475             _PACK(pipe->transfer_type, pipe->direction),
    476             pipe->max_packet_size, interval);
    477 
    478 #undef _PACK
     496            _PACK2(pipe->wire->address, pipe->endpoint_no),
     497            _PACK3(speed, pipe->transfer_type, pipe->direction),
     498            _PACK2(pipe->max_packet_size, interval));
     499
     500#undef _PACK2
     501#undef _PACK3
    479502}
    480503
Note: See TracChangeset for help on using the changeset viewer.