Changeset 09ace19 in mainline for uspace/drv/bus/usb/ohci/hc.c


Ignore:
Timestamp:
2011-08-25T15:33:41Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f974519
Parents:
cc34f5f0
Message:

ohci: remove unused code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hc.c

    rcc34f5f0 r09ace19  
    6161static int hc_init_memory(hc_t *instance);
    6262static int interrupt_emulator(hc_t *instance);
    63 /*----------------------------------------------------------------------------*/
    64 static int schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
    65 {
    66         assert(hcd);
    67         batch_init_ohci(batch);
    68         return hc_schedule(hcd->private_data, batch);
    69 }
     63static int hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch);
    7064/*----------------------------------------------------------------------------*/
    7165/** Get number of commands used in IRQ code.
     
    211205
    212206        list_initialize(&instance->pending_batches);
    213         usb_device_keeper_init(&instance->manager);
    214 
    215         ret = usb_endpoint_manager_init(&instance->ep_manager,
    216             BANDWIDTH_AVAILABLE_USB11);
    217         CHECK_RET_RETURN(ret, "Failed to initialize endpoint manager: %s.\n",
    218             str_error(ret));
    219207
    220208        ret = hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11);
     
    222210            str_error(ret));
    223211        instance->generic.private_data = instance;
    224         instance->generic.schedule = schedule;
     212        instance->generic.schedule = hc_schedule;
    225213        instance->generic.ep_add_hook = ohci_endpoint_init;
    226214
     
    302290}
    303291/*----------------------------------------------------------------------------*/
    304 /** Create and register endpoint structures.
    305  *
    306  * @param[in] instance OHCI driver structure.
    307  * @param[in] address USB address of the device.
    308  * @param[in] endpoint USB endpoint number.
    309  * @param[in] speed Communication speeed of the device.
    310  * @param[in] type Endpoint's transfer type.
    311  * @param[in] direction Endpoint's direction.
    312  * @param[in] mps Maximum packet size the endpoint accepts.
    313  * @param[in] size Maximum allowed buffer size.
    314  * @param[in] interval Time between transfers(interrupt transfers only).
    315  * @return Error code
    316  */
    317 int hc_add_endpoint(
    318     hc_t *instance, usb_address_t address, usb_endpoint_t endpoint,
    319     usb_speed_t speed, usb_transfer_type_t type, usb_direction_t direction,
    320     size_t mps, size_t size, unsigned interval)
    321 {
    322         endpoint_t *ep =
    323             endpoint_get(address, endpoint, direction, type, speed, mps);
    324         if (ep == NULL)
    325                 return ENOMEM;
    326 
    327         int ret = ohci_endpoint_init(&instance->generic, ep);
    328         if (ret != EOK) {
    329                 endpoint_destroy(ep);
    330                 return ret;
    331         }
    332 
    333         ret = usb_endpoint_manager_register_ep(&instance->ep_manager, ep, size);
    334         if (ret != EOK) {
    335                 endpoint_destroy(ep);
    336                 return ret;
    337         }
    338         hc_enqueue_endpoint(instance, ep);
    339 
    340         return EOK;
    341 }
    342 /*----------------------------------------------------------------------------*/
    343 /** Dequeue and delete endpoint structures
    344  *
    345  * @param[in] instance OHCI hc driver structure.
    346  * @param[in] address USB address of the device.
    347  * @param[in] endpoint USB endpoint number.
    348  * @param[in] direction Direction of the endpoint.
    349  * @return Error code
    350  */
    351 int hc_remove_endpoint(hc_t *instance, usb_address_t address,
    352     usb_endpoint_t endpoint, usb_direction_t direction)
    353 {
    354         assert(instance);
    355         fibril_mutex_lock(&instance->guard);
    356         endpoint_t *ep = usb_endpoint_manager_get_ep(&instance->ep_manager,
    357             address, endpoint, direction, NULL);
    358         if (ep == NULL) {
    359                 usb_log_error("Endpoint unregister failed: No such EP.\n");
    360                 fibril_mutex_unlock(&instance->guard);
    361                 return ENOENT;
    362         }
    363 
    364         ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
    365         if (ohci_ep) {
    366                 hc_dequeue_endpoint(instance, ep);
    367         } else {
    368                 usb_log_warning("Endpoint without hcd equivalent structure.\n");
    369         }
    370         int ret = usb_endpoint_manager_unregister_ep(&instance->ep_manager,
    371             address, endpoint, direction);
    372         fibril_mutex_unlock(&instance->guard);
    373         return ret;
    374 }
    375 /*----------------------------------------------------------------------------*/
    376 /** Get access to endpoint structures
    377  *
    378  * @param[in] instance OHCI hc driver structure.
    379  * @param[in] address USB address of the device.
    380  * @param[in] endpoint USB endpoint number.
    381  * @param[in] direction Direction of the endpoint.
    382  * @param[out] bw Reserved bandwidth.
    383  * @return Error code
    384  */
    385 endpoint_t * hc_get_endpoint(hc_t *instance, usb_address_t address,
    386     usb_endpoint_t endpoint, usb_direction_t direction, size_t *bw)
    387 {
    388         assert(instance);
    389         fibril_mutex_lock(&instance->guard);
    390         endpoint_t *ep = usb_endpoint_manager_get_ep(&instance->ep_manager,
    391             address, endpoint, direction, bw);
    392         fibril_mutex_unlock(&instance->guard);
    393         return ep;
    394 }
    395 /*----------------------------------------------------------------------------*/
    396292/** Add USB transfer to the schedule.
    397293 *
     
    400296 * @return Error code.
    401297 */
    402 int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch)
    403 {
    404         assert(instance);
    405         assert(batch);
    406         assert(batch->ep);
     298int hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch)
     299{
     300        assert(hcd);
     301        batch_init_ohci(batch);
     302        hc_t *instance = hcd->private_data;
     303        assert(instance);
    407304
    408305        /* Check for root hub communication */
Note: See TracChangeset for help on using the changeset viewer.