Changeset 1256a0a in mainline for uspace/drv/uhci-rhd/port.c


Ignore:
Timestamp:
2011-02-01T00:08:46Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
993a1e1
Parents:
37ac7bb
Message:

uhci-rhd - UHCI Root hub drier as a separated process

this wil deffinitely need a lot of polishing

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-rhd/port.c

    r37ac7bb r1256a0a  
    1111static int uhci_port_remove_device(uhci_port_t *port);
    1212static int uhci_port_set_enabled(uhci_port_t *port, bool enabled);
     13static int uhci_port_check(void *port);
    1314
     15int uhci_port_init(
     16  uhci_port_t *port, port_status_t *address, unsigned number,
     17  unsigned usec, device_t *rh)
     18{
     19        assert(port);
     20        port->address = address;
     21        port->number = number;
     22        port->wait_period_usec = usec;
     23        port->attached_device = 0;
     24        port->rh = rh;
     25        port->hc_phone = rh->parent_phone;
     26
     27        port->checker = fibril_create(uhci_port_check, port);
     28        if (port->checker == 0) {
     29                uhci_print_error(": failed to launch root hub fibril.");
     30                return ENOMEM;
     31        }
     32        fibril_add_ready(port->checker);
     33        uhci_print_verbose(
     34          "Added fibril for port %d: %p.\n", number, port->checker);
     35        return EOK;
     36}
     37/*----------------------------------------------------------------------------*/
     38void uhci_port_fini(uhci_port_t *port)
     39{
     40//      fibril_teardown(port->checker);
     41        return;
     42}
    1443/*----------------------------------------------------------------------------*/
    1544int uhci_port_check(void *port)
     
    1847        uhci_port_t *port_instance = port;
    1948        assert(port_instance);
    20         port_instance->hc_phone = devman_device_connect(port_instance->hc->handle, 0);
    21         if (port_instance->hc_phone < 0) {
    22                 uhci_print_fatal("Failed(%d) to connect to the hc(handle=%x.\n",
    23                         port_instance->hc_phone, (unsigned)port_instance->hc->handle);
    24                 return port_instance->hc_phone;
    25         }
    2649
    2750        while (1) {
     
    119142        assert(port->attached_device == 0);
    120143
    121         ret = usb_drv_register_child_in_devman(port->hc_phone, port->hc, usb_address,
    122                 &port->attached_device);
     144        ret = usb_drv_register_child_in_devman(port->hc_phone, port->rh,
     145          usb_address, &port->attached_device);
    123146
    124147        if (ret != EOK) { /* something went wrong */
Note: See TracChangeset for help on using the changeset viewer.