Changeset 1ae51ae in mainline for uspace/drv/uhci-rhd/port.c
- Timestamp:
- 2011-02-27T02:39:13Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ad6857c
- Parents:
- 48563a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-rhd/port.c
r48563a3 r1ae51ae 92 92 uhci_port_t *port_instance = port; 93 93 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; 95 97 96 98 while (1) { 99 async_usleep(port_instance->wait_period_usec); 100 97 101 /* read register value */ 98 102 port_status_t port_status = … … 102 106 static fibril_mutex_t dbg_mtx = FIBRIL_MUTEX_INITIALIZER(dbg_mtx); 103 107 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++); 106 110 // print_port_status(port_status); 107 111 fibril_mutex_unlock(&dbg_mtx); 108 112 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 111 118 int rc = usb_hc_connection_open( 112 119 &port_instance->hc_connection); 113 120 if (rc != EOK) { 114 121 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 } 121 124 122 125 /* remove any old device */ … … 127 130 } 128 131 129 if ( port_status & STATUS_CONNECTED) {132 if ((port_status & STATUS_CONNECTED) != 0) { 130 133 /* new device */ 131 134 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); 132 140 } 133 141 … … 136 144 if (rc != EOK) { 137 145 usb_log_error("Failed to disconnect from HC."); 138 goto next;139 146 } 140 147 } 141 next:142 async_usleep(port_instance->wait_period_usec);143 148 } 144 149 return EOK; … … 202 207 new_device_enable_port, port->number, port, 203 208 &dev_addr, &port->attached_device, NULL, NULL, NULL); 209 204 210 if (rc != EOK) { 205 211 usb_log_error("Failed adding new device on port %u: %s.\n",
Note:
See TracChangeset
for help on using the changeset viewer.