Ignore:
Timestamp:
2010-12-04T16:58:31Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ad104e0
Parents:
36c410e
Message:

Add address reservation to USBHC interface in DDF

Any USB driver that needs to assign new USB address shall ask its HC
for it. When using default USB address (address 0), it must inform
HC about it as HC is the only element able to provide serialization.

File:
1 edited

Legend:

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

    r36c410e r6f04905  
    5252static void remote_usbhc_control_read_data(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5353static void remote_usbhc_control_read_status(device_t *, void *, ipc_callid_t, ipc_call_t *);
     54static void remote_usbhc_reserve_default_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
     55static void remote_usbhc_release_default_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
     56static void remote_usbhc_request_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
     57static void remote_usbhc_release_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5458//static void remote_usbhc(device_t *, void *, ipc_callid_t, ipc_call_t *);
    5559
     
    5761static remote_iface_func_ptr_t remote_usbhc_iface_ops [] = {
    5862        remote_usbhc_get_address,
     63
    5964        remote_usbhc_get_buffer,
     65
     66        remote_usbhc_reserve_default_address,
     67        remote_usbhc_release_default_address,
     68
     69        remote_usbhc_request_address,
     70        remote_usbhc_release_address,
     71
    6072        remote_usbhc_interrupt_out,
    6173        remote_usbhc_interrupt_in,
     74
    6275        remote_usbhc_control_write_setup,
    6376        remote_usbhc_control_write_data,
    6477        remote_usbhc_control_write_status,
     78
    6579        remote_usbhc_control_read_setup,
    6680        remote_usbhc_control_read_data,
     
    134148        free(trans->buffer);
    135149        free(trans);
     150}
     151
     152void remote_usbhc_reserve_default_address(device_t *device, void *iface,
     153    ipc_callid_t callid, ipc_call_t *call)
     154{
     155        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
     156
     157        if (!usb_iface->reserve_default_address) {
     158                ipc_answer_0(callid, ENOTSUP);
     159                return;
     160        }
     161
     162        int rc = usb_iface->reserve_default_address(device);
     163
     164        ipc_answer_0(callid, rc);
     165}
     166
     167void remote_usbhc_release_default_address(device_t *device, void *iface,
     168    ipc_callid_t callid, ipc_call_t *call)
     169{
     170        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
     171
     172        if (!usb_iface->release_default_address) {
     173                ipc_answer_0(callid, ENOTSUP);
     174                return;
     175        }
     176
     177        int rc = usb_iface->release_default_address(device);
     178
     179        ipc_answer_0(callid, rc);
     180}
     181
     182void remote_usbhc_request_address(device_t *device, void *iface,
     183    ipc_callid_t callid, ipc_call_t *call)
     184{
     185        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
     186
     187        if (!usb_iface->request_address) {
     188                ipc_answer_0(callid, ENOTSUP);
     189                return;
     190        }
     191
     192        usb_address_t address;
     193        int rc = usb_iface->request_address(device, &address);
     194        if (rc != EOK) {
     195                ipc_answer_0(callid, rc);
     196        } else {
     197                ipc_answer_1(callid, EOK, (ipcarg_t) address);
     198        }
     199}
     200
     201void remote_usbhc_release_address(device_t *device, void *iface,
     202    ipc_callid_t callid, ipc_call_t *call)
     203{
     204        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
     205
     206        if (!usb_iface->release_address) {
     207                ipc_answer_0(callid, ENOTSUP);
     208                return;
     209        }
     210
     211        usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);
     212
     213        int rc = usb_iface->release_address(device, address);
     214
     215        ipc_answer_0(callid, rc);
    136216}
    137217
Note: See TracChangeset for help on using the changeset viewer.