Changeset 62d9827 in mainline


Ignore:
Timestamp:
2011-01-29T07:54:54Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
816175a2
Parents:
86b39f7e
Message:

Switched to address hadling interface, instead of direct access.

Location:
uspace/drv/uhci/root_hub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/root_hub/port.c

    r86b39f7e r62d9827  
    11
    22#include <errno.h>
    3 //#include <usb/devreq.h> /* for usb_device_request_setup_packet_t */
    43#include <usb/usb.h>
    54#include <usb/usbdrv.h>
    65
    76#include "debug.h"
    8 #include "uhci.h"
    97#include "port.h"
    108#include "port_status.h"
     
    5048{
    5149        assert(port);
    52         assert(port->hc);
     50        assert(port->hc_phone);
    5351
    5452        uhci_print_info("Adding new device on port %d.\n", port->number);
    5553
    56         uhci_t *uhci_instance = (uhci_t*)(port->hc->driver_data);
    5754
    5855        /* get default address */
    59         usb_address_keeping_reserve_default(&uhci_instance->address_manager);
     56        int ret = usb_drv_reserve_default_address(port->hc_phone);
     57        if (ret != EOK) {
     58                uhci_print_error("Failed to reserve default address.\n");
     59                return ret;
     60        }
    6061
    61         const usb_address_t usb_address =
    62           usb_address_keeping_request(&uhci_instance->address_manager);
     62        const usb_address_t usb_address = usb_drv_request_address(port->hc_phone);
    6363
    6464        if (usb_address <= 0) {
     65                uhci_print_error("Recieved invalid address(%d).\n", usb_address);
    6566                return usb_address;
    6667        }
     
    8889
    8990        /* assign address to device */
    90         int ret = usb_drv_req_set_address(port->hc_phone, 0, usb_address);
     91        ret = usb_drv_req_set_address(port->hc_phone, 0, usb_address);
    9192
    9293
     
    9495                uhci_print_error("Failed(%d) to assign address to the device.\n", ret);
    9596                uhci_port_set_enabled(port, false);
    96                 usb_address_keeping_release_default(&uhci_instance->address_manager);
    97                 return ENOMEM;
     97                int release = usb_drv_release_default_address(port->hc_phone);
     98                if (release != EOK) {
     99                        uhci_print_fatal("Failed to release default address.\n");
     100                        return release;
     101                }
     102                return ret;
    98103        }
    99104
    100105        /* release default address */
    101         usb_address_keeping_release_default(&uhci_instance->address_manager);
     106        ret = usb_drv_release_default_address(port->hc_phone);
     107        if (ret != EOK) {
     108                uhci_print_fatal("Failed to release default address.\n");
     109                return ret;
     110        }
    102111
    103112        /* communicate and possibly report to devman */
     
    113122        }
    114123
     124        /* TODO: bind the address here */
     125
    115126        return EOK;
    116127}
     
    119130{
    120131        uhci_print_error("Don't know how to remove device %#x.\n",
    121                 port->attached_device);
     132                (unsigned int)port->attached_device);
    122133        uhci_port_set_enabled(port, false);
    123134        return EOK;
  • uspace/drv/uhci/root_hub/root_hub.c

    r86b39f7e r62d9827  
    1212int uhci_root_hub_init( uhci_root_hub_t *hub, device_t *hc, void *addr )
    1313{
    14         assert( hub );
     14        assert(hub);
    1515
    1616        /* allow access to root hub registers */
Note: See TracChangeset for help on using the changeset viewer.