Changeset 1ae51ae in mainline


Ignore:
Timestamp:
2011-02-27T02:39:13Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ad6857c
Parents:
48563a3
Message:

Refactoring

Location:
uspace/drv
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/iface.c

    r48563a3 r1ae51ae  
    149149        assert(hc);
    150150        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     151        usb_log_debug("Control WRITE %d:%d %zu(%zu).\n",
     152            target.address, target.endpoint, size, max_packet_size);
    151153
    152154        batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
     
    169171        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
    170172
     173        usb_log_debug("Control READ %d:%d %zu(%zu).\n",
     174            target.address, target.endpoint, size, max_packet_size);
    171175        batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
    172176            max_packet_size, speed, data, size, setup_data, setup_size, callback,
  • uspace/drv/uhci-hcd/uhci.c

    r48563a3 r1ae51ae  
    4848        {
    4949                .cmd = CMD_PIO_READ_16,
    50                 .addr = (void*)0xc022,
     50                .addr = NULL, /* patched for every instance */
    5151                .dstarg = 1
    5252        },
    5353        {
    5454                .cmd = CMD_PIO_WRITE_16,
    55                 .addr = (void*)0xc022,
     55                .addr = NULL, /* pathed for every instance */
    5656                .value = 0x1f
    5757        },
     
    6161};
    6262
    63 
    6463static int usb_iface_get_address(ddf_fun_t *fun, devman_handle_t handle,
    6564    usb_address_t *address)
     
    6968        assert(hc);
    7069
    71 //      usb_address_t addr = usb_address_keeping_find(&hc->address_manager,
    72 //          handle);
    7370        usb_address_t addr = device_keeper_find(&hc->device_manager,
    7471            handle);
  • uspace/drv/uhci-rhd/port.c

    r48563a3 r1ae51ae  
    9292        uhci_port_t *port_instance = port;
    9393        assert(port_instance);
    94 //      port_status_write(port_instance->address, 0);
     94        port_status_write(port_instance->address, 0);
     95
     96        uint64_t count = 0;
    9597
    9698        while (1) {
     99                async_usleep(port_instance->wait_period_usec);
     100
    97101                /* read register value */
    98102                port_status_t port_status =
     
    102106                static fibril_mutex_t dbg_mtx = FIBRIL_MUTEX_INITIALIZER(dbg_mtx);
    103107                fibril_mutex_lock(&dbg_mtx);
    104                 usb_log_debug("Port %d status at %p: 0x%04x.\n",
    105                   port_instance->number, port_instance->address, port_status);
     108                usb_log_debug("Port %d status at %p: 0x%04x. === %llu\n",
     109                  port_instance->number, port_instance->address, port_status, count++);
    106110//              print_port_status(port_status);
    107111                fibril_mutex_unlock(&dbg_mtx);
    108112
    109                 if (port_status & STATUS_CONNECTED_CHANGED) {
    110                         usb_log_debug("Change detected on port %d.\n", port_instance->number);
     113                if ((port_status & STATUS_CONNECTED_CHANGED) != 0) {
     114                        usb_log_debug("Change detected on port %d: %x.\n",
     115                            port_instance->number, port_status);
     116
     117
    111118                        int rc = usb_hc_connection_open(
    112119                            &port_instance->hc_connection);
    113120                        if (rc != EOK) {
    114121                                usb_log_error("Failed to connect to HC.");
    115                                 goto next;
    116                         }
    117 
    118                         port_status_write(port_instance->address, port_status);
    119                         usb_log_debug("Change status ack on port %d.\n",
    120                             port_instance->number);
     122                                continue;
     123                        }
    121124
    122125                        /* remove any old device */
     
    127130                        }
    128131
    129                         if (port_status & STATUS_CONNECTED) {
     132                        if ((port_status & STATUS_CONNECTED) != 0) {
    130133                                /* new device */
    131134                                uhci_port_new_device(port_instance, port_status);
     135                        } else {
     136                                /* ack changes by writing one to WC bits */
     137                                port_status_write(port_instance->address, port_status);
     138                                usb_log_debug("Change status ack on port %d.\n",
     139                                                port_instance->number);
    132140                        }
    133141
     
    136144                        if (rc != EOK) {
    137145                                usb_log_error("Failed to disconnect from HC.");
    138                                 goto next;
    139146                        }
    140147                }
    141         next:
    142                 async_usleep(port_instance->wait_period_usec);
    143148        }
    144149        return EOK;
     
    202207            new_device_enable_port, port->number, port,
    203208            &dev_addr, &port->attached_device, NULL, NULL, NULL);
     209
    204210        if (rc != EOK) {
    205211                usb_log_error("Failed adding new device on port %u: %s.\n",
Note: See TracChangeset for help on using the changeset viewer.