Ignore:
Timestamp:
2011-03-18T14:17:27Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb41b85
Parents:
a8def7d (diff), 4f66cc7b (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:

Merged changes from branch lelian/hidd

File:
1 edited

Legend:

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

    ra8def7d r6e3b9a58  
    5555static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5656static void remote_usbhc_release_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     57static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     58static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5759//static void remote_usbhc(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5860
     
    7375
    7476        remote_usbhc_control_write,
    75         remote_usbhc_control_read
     77        remote_usbhc_control_read,
     78
     79        remote_usbhc_register_endpoint,
     80        remote_usbhc_unregister_endpoint
    7681};
    7782
     
    522527
    523528
     529void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
     530    ipc_callid_t callid, ipc_call_t *call)
     531{
     532        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
     533
     534        if (!usb_iface->register_endpoint) {
     535                async_answer_0(callid, ENOTSUP);
     536                return;
     537        }
     538
     539#define INIT_FROM_HIGH_DATA(type, var, arg_no) \
     540        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / 256
     541#define INIT_FROM_LOW_DATA(type, var, arg_no) \
     542        type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % 256
     543
     544        INIT_FROM_HIGH_DATA(usb_address_t, address, 1);
     545        INIT_FROM_LOW_DATA(usb_endpoint_t, endpoint, 1);
     546        INIT_FROM_HIGH_DATA(usb_transfer_type_t, transfer_type, 2);
     547        INIT_FROM_LOW_DATA(usb_direction_t, direction, 2);
     548
     549#undef INIT_FROM_HIGH_DATA
     550#undef INIT_FROM_LOW_DATA
     551
     552        size_t max_packet_size = (size_t) DEV_IPC_GET_ARG3(*call);
     553        unsigned int interval  = (unsigned int) DEV_IPC_GET_ARG4(*call);
     554
     555        int rc = usb_iface->register_endpoint(fun, address, endpoint,
     556            transfer_type, direction, max_packet_size, interval);
     557
     558        async_answer_0(callid, rc);
     559}
     560
     561
     562void remote_usbhc_unregister_endpoint(ddf_fun_t *fun, void *iface,
     563    ipc_callid_t callid, ipc_call_t *call)
     564{
     565        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
     566
     567        if (!usb_iface->unregister_endpoint) {
     568                async_answer_0(callid, ENOTSUP);
     569                return;
     570        }
     571
     572        usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
     573        usb_endpoint_t endpoint = (usb_endpoint_t) DEV_IPC_GET_ARG2(*call);
     574        usb_direction_t direction = (usb_direction_t) DEV_IPC_GET_ARG3(*call);
     575
     576        int rc = usb_iface->unregister_endpoint(fun,
     577            address, endpoint, direction);
     578
     579        async_answer_0(callid, rc);
     580}
     581
    524582
    525583/**
Note: See TracChangeset for help on using the changeset viewer.