Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 0e126be7 in mainline


Ignore:
Timestamp:
2010-11-20T13:17:54Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
4b4c797
Parents:
e27595b
Message:

USB drivers specifies full target in requests

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbkbd/main.c

    re27595b r0e126be7  
    4141        usb_endpoint_t poll_endpoint = 1;
    4242
    43         rc = usb_drv_async_interrupt_in(dev->parent_phone, poll_endpoint,
     43        usb_address_t my_address = usb_drv_get_my_address(dev->parent_phone,
     44            dev);
     45        if (my_address < 0) {
     46                return;
     47        }
     48
     49        usb_target_t poll_target = {
     50                .address = my_address,
     51                .endpoint = poll_endpoint
     52        };
     53
     54        rc = usb_drv_async_interrupt_in(dev->parent_phone, poll_target,
    4455            buffer, BUFFER_SIZE, &actual_size, &handle);
    4556        if (rc != EOK) {
  • uspace/lib/usb/usbdrv.c

    re27595b r0e126be7  
    6767}
    6868
     69/** Tell USB address assigned to given device.
     70 *
     71 * @param phone Phone to my HC.
     72 * @param dev Device in question.
     73 * @return USB address or error code.
     74 */
     75usb_address_t usb_drv_get_my_address(int phone, device_t *dev)
     76{
     77        return ENOTSUP;
     78}
     79
    6980/** Send data to HCD.
    7081 *
    7182 * @param phone Phone to HC.
    7283 * @param method Method used for calling.
    73  * @param endpoint Device endpoint.
     84 * @param target Targeted device.
    7485 * @param buffer Data buffer (NULL to skip data transfer phase).
    7586 * @param size Buffer size (must be zero when @p buffer is NULL).
     
    8091 */
    8192static int async_send_buffer(int phone, int method,
    82     usb_endpoint_t endpoint,
     93    usb_target_t target,
    8394    void *buffer, size_t size,
    8495    usb_handle_t *handle)
     
    109120        int rc;
    110121
    111         transfer->request = async_send_3(phone,
     122        transfer->request = async_send_4(phone,
    112123            DEV_IFACE_ID(USB_DEV_IFACE),
    113124            method,
    114             endpoint,
     125            target.address, target.endpoint,
    115126            size,
    116127            &transfer->reply);
     
    133144 * @param phone Opened phone to HCD.
    134145 * @param method Method used for calling.
    135  * @param endpoint Device endpoint.
     146 * @param target Targeted device.
    136147 * @param buffer Buffer where to store retrieved data
    137148 *      (NULL to skip data transfer phase).
     
    145156 */
    146157static int async_recv_buffer(int phone, int method,
    147     usb_endpoint_t endpoint,
     158    usb_target_t target,
    148159    void *buffer, size_t size, size_t *actual_size,
    149160    usb_handle_t *handle)
     
    172183        transfer->phone = phone;
    173184
    174         transfer->request = async_send_3(phone,
     185        transfer->request = async_send_4(phone,
    175186            DEV_IFACE_ID(USB_DEV_IFACE),
    176187            method,
    177             endpoint,
     188            target.address, target.endpoint,
    178189            size,
    179190            &transfer->reply);
     
    289300
    290301/** Send interrupt data to device. */
    291 int usb_drv_async_interrupt_out(int phone, usb_endpoint_t endpoint,
     302int usb_drv_async_interrupt_out(int phone, usb_target_t target,
    292303    void *buffer, size_t size,
    293304    usb_handle_t *handle)
     
    295306        return async_send_buffer(phone,
    296307            IPC_M_USB_INTERRUPT_OUT,
    297             endpoint,
     308            target,
    298309            buffer, size,
    299310            handle);
     
    301312
    302313/** Request interrupt data from device. */
    303 int usb_drv_async_interrupt_in(int phone, usb_endpoint_t endpoint,
     314int usb_drv_async_interrupt_in(int phone, usb_target_t target,
    304315    void *buffer, size_t size, size_t *actual_size,
    305316    usb_handle_t *handle)
     
    307318        return async_recv_buffer(phone,
    308319            IPC_M_USB_INTERRUPT_IN,
    309             endpoint,
     320            target,
    310321            buffer, size, actual_size,
    311322            handle);
  • uspace/lib/usb/usbdrv.h

    re27595b r0e126be7  
    4141int usb_drv_hc_connect(device_t *, unsigned int);
    4242
    43 int usb_drv_async_interrupt_out(int, usb_endpoint_t,
     43usb_address_t usb_drv_get_my_address(int, device_t *);
     44
     45int usb_drv_async_interrupt_out(int, usb_target_t,
    4446    void *, size_t, usb_handle_t *);
    45 int usb_drv_async_interrupt_in(int, usb_endpoint_t,
     47int usb_drv_async_interrupt_in(int, usb_target_t,
    4648    void *, size_t, size_t *, usb_handle_t *);
    4749
Note: See TracChangeset for help on using the changeset viewer.