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

Changeset ef4e8eb in mainline


Ignore:
Timestamp:
2013-01-15T20:39:09Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
ef40434
Parents:
918e1e84
Message:

Remove unused usb hub code.

All the functionality is now handled by hc driver and libusbhost.

Location:
uspace
Files:
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkbd/main.c

    r918e1e84 ref4e8eb  
    4444#include <devman.h>
    4545#include <loc.h>
    46 #include <usb/dev/hub.h>
    4746#include <usb/hid/iface.h>
    4847#include <usb/dev/pipes.h>
  • uspace/drv/bus/usb/usbhub/port.c

    r918e1e84 ref4e8eb  
    4141
    4242#include <usb/debug.h>
    43 #include <usb/dev/hub.h>
    4443
    4544#include "port.h"
  • uspace/drv/bus/usb/usbhub/port.h

    r918e1e84 ref4e8eb  
    3737
    3838#include <usb/dev/driver.h>
    39 #include <usb/dev/hub.h>
    4039#include <usb/classes/hub.h>
    4140
  • uspace/drv/bus/usb/usbhub/usbhub.h

    r918e1e84 ref4e8eb  
    3939#include <ddf/driver.h>
    4040
    41 #include <usb/dev/hub.h>
    4241#include <usb/classes/hub.h>
    4342
  • uspace/lib/usb/include/usb/hc.h

    r918e1e84 ref4e8eb  
    8484int usb_hc_connection_close(usb_hc_connection_t *);
    8585
    86 usb_address_t usb_hc_request_address(usb_hc_connection_t *, usb_address_t, bool,
    87     usb_speed_t);
    88 int usb_hc_bind_address(usb_hc_connection_t *, usb_address_t, devman_handle_t);
    8986int usb_hc_get_handle_by_address(usb_hc_connection_t *, usb_address_t,
    9087    devman_handle_t *);
    91 int usb_hc_release_address(usb_hc_connection_t *, usb_address_t);
    9288
    9389int usb_hc_register_endpoint(usb_hc_connection_t *, usb_address_t,
  • uspace/lib/usb/src/ddfiface.c

    r918e1e84 ref4e8eb  
    4040#include <usb/hc.h>
    4141#include <usb/debug.h>
    42 #include <usb/dev/hub.h>
    4342#include <errno.h>
    4443#include <assert.h>
     
    5251};
    5352
    54 /** DDF interface for USB device, implementation for child of a typical hub. */
    55 usb_iface_t usb_iface_hub_child_impl = {
    56         .get_hc_handle = usb_iface_get_hc_handle_device_impl,
    57         .get_my_address = usb_iface_get_my_address_from_device_data,
    58 };
    59 
    60 
    6153/** Get host controller handle, interface implementation for hub driver.
    6254 *
     
    6961        assert(fun);
    7062        return usb_get_hc_by_handle(ddf_fun_get_handle(fun), handle);
    71 }
    72 
    73 /** Get host controller handle, interface implementation for HC driver.
    74  *
    75  * @param[in] fun Device function the operation is running on.
    76  * @param[out] handle Storage for the host controller handle.
    77  * @return Always EOK.
    78  */
    79 int usb_iface_get_hc_handle_hc_impl(ddf_fun_t *fun, devman_handle_t *handle)
    80 {
    81         assert(fun);
    82 
    83         if (handle != NULL) {
    84                 *handle = ddf_fun_get_handle(fun);
    85         }
    86 
    87         return EOK;
    8863}
    8964
     
    10277}
    10378
    104 /** Get USB device address, interface implementation for child of
    105  * a hub driver.
    106  *
    107  * This implementation eccepts 0 as valid handle and replaces it with fun's
    108  * handle.
    109  *
    110  * @param[in] fun Device function the operation is running on.
    111  * @param[in] handle Devman handle of USB device we want address of.
    112  * @param[out] address Storage for USB address of device with handle @p handle.
    113  * @return Error code.
    114  */
    115 int usb_iface_get_my_address_from_device_data(ddf_fun_t *fun,
    116     usb_address_t *address)
    117 {
    118         const usb_hub_attached_device_t *device = ddf_fun_data_get(fun);
    119         assert(device->fun == fun);
    120         if (address)
    121                 *address = device->address;
    122         return EOK;
    123 }
    12479
    12580/**
  • uspace/lib/usb/src/hc.c

    r918e1e84 ref4e8eb  
    164164}
    165165
    166 /** Ask host controller for free address assignment.
    167  *
    168  * @param connection Opened connection to host controller.
    169  * @param preferred Preferred SUB address.
    170  * @param strict Fail if the preferred address is not avialable.
    171  * @param speed Speed of the new device (device that will be assigned
    172  *    the returned address).
    173  * @return Assigned USB address or negative error code.
    174  */
    175 usb_address_t usb_hc_request_address(usb_hc_connection_t *connection,
    176     usb_address_t preferred, bool strict, usb_speed_t speed)
    177 {
    178         async_exch_t *exch;
    179         EXCH_INIT(connection, exch);
    180 
    181         usb_address_t address = preferred;
    182         const int ret = usbhc_request_address(exch, &address, strict, speed);
    183 
    184         EXCH_FINI(connection, exch);
    185         return ret == EOK ? address : ret;
    186 }
    187 
    188 int usb_hc_bind_address(usb_hc_connection_t * connection,
    189     usb_address_t address, devman_handle_t handle)
    190 {
    191         async_exch_t *exch;
    192         EXCH_INIT(connection, exch);
    193 
    194         const int ret = usbhc_bind_address(exch, address, handle);
    195 
    196         EXCH_FINI(connection, exch);
    197         return ret;
    198 }
    199166
    200167/** Get handle of USB device with given address.
     
    217184}
    218185
    219 int usb_hc_release_address(usb_hc_connection_t *connection,
    220     usb_address_t address)
    221 {
    222         async_exch_t *exch;
    223         EXCH_INIT(connection, exch);
    224 
    225         const int ret = usbhc_release_address(exch, address);
    226 
    227         EXCH_FINI(connection, exch);
    228         return ret;
    229 }
    230 
    231186int usb_hc_register_endpoint(usb_hc_connection_t *connection,
    232187    usb_address_t address, usb_endpoint_t endpoint, usb_transfer_type_t type,
  • uspace/lib/usbdev/Makefile

    r918e1e84 ref4e8eb  
    3939        src/devpoll.c \
    4040        src/dp.c \
    41         src/hub.c \
    4241        src/pipes.c \
    4342        src/pipesinit.c \
  • uspace/lib/usbdev/src/recognise.c

    r918e1e84 ref4e8eb  
    3737#include <fibril_synch.h>
    3838#include <usb/debug.h>
    39 #include <usb/dev/hub.h>
    4039#include <usb/dev/pipes.h>
    4140#include <usb/dev/recognise.h>
     
    4645#include <errno.h>
    4746#include <assert.h>
    48 
    49 /** DDF operations of child devices. */
    50 static ddf_dev_ops_t child_ops = {
    51         .interfaces[USB_DEV_IFACE] = &usb_iface_hub_child_impl
    52 };
    5347
    5448/** Get integer part from BCD coded number. */
     
    295289}
    296290
    297 /** Probe for device kind and register it in devman.
    298  *
    299  * @param[in] ctrl_pipe Control pipe to the device.
    300  * @param[in] parent Parent device.
    301  * @param[in] dev_ops Child device ops. Default child_ops will be used if NULL.
    302  * @param[in] dev_data Arbitrary pointer to be stored in the child
    303  *      as @c driver_data.
    304  * @param[out] child_fun Storage where pointer to allocated child function
    305  *      will be written.
    306  * @return Error code.
    307  *
    308  */
    309 int usb_device_register_child_in_devman(usb_pipe_t *ctrl_pipe,
    310     ddf_dev_t *parent, ddf_fun_t **child_fun)
    311 {
    312         if (child_fun == NULL || ctrl_pipe == NULL)
    313                 return EINVAL;
    314        
    315         /** Index to append after device name for uniqueness. */
    316         static atomic_t device_name_index = {0};
    317         const size_t this_device_name_index =
    318             (size_t) atomic_preinc(&device_name_index);
    319        
    320         ddf_fun_t *child = NULL;
    321         int rc;
    322        
    323         /*
    324          * TODO: Once the device driver framework support persistent
    325          * naming etc., something more descriptive could be created.
    326          */
    327         char child_name[12];  /* The format is: "usbAB_aXYZ", length 11 */
    328         rc = snprintf(child_name, sizeof(child_name),
    329             "usb%02zu_a%d", this_device_name_index, ctrl_pipe->wire->address);
    330         if (rc < 0) {
    331                 goto failure;
    332         }
    333        
    334         child = ddf_fun_create(parent, fun_inner, child_name);
    335         if (child == NULL) {
    336                 rc = ENOMEM;
    337                 goto failure;
    338         }
    339        
    340         ddf_fun_set_ops(child, &child_ops);
    341         /*
    342          * Store the attached device in fun
    343          * driver data if there is no other data
    344          */
    345         usb_hub_attached_device_t *new_device = ddf_fun_data_alloc(
    346             child, sizeof(usb_hub_attached_device_t));
    347         if (!new_device) {
    348                 rc = ENOMEM;
    349                 goto failure;
    350         }
    351        
    352         new_device->address = ctrl_pipe->wire->address;
    353         new_device->fun = child;
    354        
    355         match_id_list_t match_ids;
    356         init_match_ids(&match_ids);
    357         rc = usb_device_create_match_ids(ctrl_pipe, &match_ids);
    358         if (rc != EOK)
    359                 goto failure;
    360        
    361         list_foreach(match_ids.ids, id_link) {
    362                 match_id_t *match_id = list_get_instance(id_link, match_id_t, link);
    363                 rc = ddf_fun_add_match_id(child, match_id->id, match_id->score);
    364                 if (rc != EOK) {
    365                         clean_match_ids(&match_ids);
    366                         goto failure;
    367                 }
    368         }
    369        
    370         clean_match_ids(&match_ids);
    371        
    372         rc = ddf_fun_bind(child);
    373         if (rc != EOK)
    374                 goto failure;
    375        
    376         *child_fun = child;
    377         return EOK;
    378        
    379 failure:
    380         if (child != NULL) {
    381                 /* This takes care of match_id deallocation as well. */
    382                 ddf_fun_destroy(child);
    383         }
    384        
    385         return rc;
    386 }
    387 
    388291/**
    389292 * @}
Note: See TracChangeset for help on using the changeset viewer.