Changeset dced52a in mainline
- Timestamp:
- 2011-02-28T12:24:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86341e2, cc44f7e
- Parents:
- 4abc304
- Location:
- uspace/drv/uhci-rhd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-rhd/main.c
r4abc304 rdced52a 116 116 int main(int argc, char *argv[]) 117 117 { 118 usb_log_enable(USB_LOG_LEVEL_ INFO, NAME);118 usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME); 119 119 return ddf_driver_main(&uhci_rh_driver); 120 120 } -
uspace/drv/uhci-rhd/port.c
r4abc304 rdced52a 71 71 port->checker = fibril_create(uhci_port_check, port); 72 72 if (port->checker == 0) { 73 usb_log_error(": failed to launch root hub fibril."); 73 usb_log_error("Port(%p - %d): failed to launch root hub fibril.", 74 port->address, port->number); 74 75 return ENOMEM; 75 76 } 76 77 fibril_add_ready(port->checker); 77 usb_log_debug( 78 "Added fibril for port %d: %p.\n",number, port->checker);78 usb_log_debug("Port(%p - %d): Added fibril. %x\n", 79 port->address, port->number, port->checker); 79 80 return EOK; 80 81 } … … 92 93 uhci_port_t *port_instance = port; 93 94 assert(port_instance); 94 port_status_write(port_instance->address, 0);95 96 u int64_tcount = 0;95 // port_status_write(port_instance->address, 0); 96 97 unsigned count = 0; 97 98 98 99 while (1) { … … 106 107 static fibril_mutex_t dbg_mtx = FIBRIL_MUTEX_INITIALIZER(dbg_mtx); 107 108 fibril_mutex_lock(&dbg_mtx); 108 usb_log_debug ("Port %d status at %p: 0x%04x. === %llu\n",109 port_instance-> number, port_instance->address, port_status, count++);109 usb_log_debug2("Port(%p - %d): Status: %#04x. === %u\n", 110 port_instance->address, port_instance->number, port_status, count++); 110 111 // print_port_status(port_status); 111 112 fibril_mutex_unlock(&dbg_mtx); 112 113 113 114 if ((port_status & STATUS_CONNECTED_CHANGED) != 0) { 114 usb_log_debug(" Change detected on port %d: %x.\n",115 port_instance-> number, port_status);115 usb_log_debug("Port(%p - %d): Connected change detected: %x.\n", 116 port_instance->address, port_instance->number, port_status); 116 117 117 118 … … 119 120 &port_instance->hc_connection); 120 121 if (rc != EOK) { 121 usb_log_error("Failed to connect to HC."); 122 usb_log_error("Port(%p - %d): Failed to connect to HC.", 123 port_instance->address, port_instance->number); 122 124 continue; 123 125 } … … 125 127 /* remove any old device */ 126 128 if (port_instance->attached_device) { 127 usb_log_debug(" Removing device on port %d.\n",128 port_instance-> number);129 usb_log_debug("Port(%p - %d): Removing device.\n", 130 port_instance->address, port_instance->number); 129 131 uhci_port_remove_device(port_instance); 130 132 } … … 136 138 /* ack changes by writing one to WC bits */ 137 139 port_status_write(port_instance->address, port_status); 138 usb_log_debug(" Change status ack on port %d.\n",139 port_instance-> number);140 usb_log_debug("Port(%p - %d): Change status ACK.\n", 141 port_instance->address, port_instance->number); 140 142 } 141 143 … … 143 145 &port_instance->hc_connection); 144 146 if (rc != EOK) { 145 usb_log_error("Failed to disconnect from HC."); 147 usb_log_error("Port(%p - %d): Failed to disconnect from HC.", 148 port_instance->address, port_instance->number); 146 149 } 147 150 } … … 160 163 uhci_port_t *port = (uhci_port_t *) arg; 161 164 162 usb_log_debug("new_device_enable_port(%d)\n", port->number); 165 usb_log_debug2("Port(%p - %d): new_device_enable_port.\n", 166 port->address, port->number); 163 167 164 168 /* … … 173 177 */ 174 178 { 175 usb_log_debug(" Reset Signal start on port %d.\n",176 port-> number);179 usb_log_debug("Port(%p - %d): Reset Signal start.\n", 180 port->address, port->number); 177 181 port_status_t port_status = 178 182 port_status_read(port->address); … … 184 188 port_status &= ~STATUS_IN_RESET; 185 189 port_status_write(port->address, port_status); 186 usb_log_debug(" Reset Signal stop on port %d.\n",187 port-> number);190 usb_log_debug("Port(%p - %d): Reset Signal stop.\n", 191 port->address, port->number); 188 192 } 189 193 … … 200 204 assert(usb_hc_connection_is_opened(&port->hc_connection)); 201 205 202 usb_log_info("Detected new device on port %u.\n", port->number); 206 usb_log_info("Port(%p-%d): Detected new device.\n", 207 port->address, port->number); 203 208 204 209 usb_address_t dev_addr; … … 209 214 210 215 if (rc != EOK) { 211 usb_log_error(" Failed adding new device on port %u: %s.\n",212 port-> number, str_error(rc));216 usb_log_error("Port(%p-%d): Failed(%d) adding new device: %s.\n", 217 port->address, port->number, rc, str_error(rc)); 213 218 uhci_port_set_enabled(port, false); 214 219 return rc; 215 220 } 216 221 217 usb_log_info(" New device on port %uhas address %d (handle %zu).\n",218 port-> number, dev_addr, port->attached_device);222 usb_log_info("Port(%p-%d): New device has address %d (handle %zu).\n", 223 port->address, port->number, dev_addr, port->attached_device); 219 224 220 225 return EOK; … … 224 229 static int uhci_port_remove_device(uhci_port_t *port) 225 230 { 226 usb_log_error(" Don't know how to remove device %#x.\n",227 (unsigned int)port->attached_device);231 usb_log_error("Port(%p-%d): Don't know how to remove device %#x.\n", 232 port->address, port->number, (unsigned int)port->attached_device); 228 233 // uhci_port_set_enabled(port, false); 229 234 return EOK; … … 246 251 port_status_write(port->address, port_status); 247 252 248 usb_log_info(" %s port %d.\n",249 enabled ? "Enabled" : "Disabled", port->number);253 usb_log_info("Port(%p-%d): %sabled port.\n", 254 port->address, port->number, enabled ? "En" : "Dis"); 250 255 return EOK; 251 256 } -
uspace/drv/uhci-rhd/root_hub.c
r4abc304 rdced52a 46 46 assert(rh); 47 47 int ret; 48 ret = usb_hc_find(rh->handle, &instance->hc_handle);49 usb_log_info("rh found(%d) hc handle: %d.\n", ret, instance->hc_handle);50 if (ret != EOK) {51 return ret;52 }53 48 54 49 /* allow access to root hub registers */ 55 50 assert(sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT == size); 56 51 port_status_t *regs; 57 ret = pio_enable( 58 addr, sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT, (void**)®s); 52 ret = pio_enable(addr, size, (void**)®s); 59 53 60 54 if (ret < 0) { … … 67 61 for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) { 68 62 /* mind pointer arithmetics */ 69 intret = uhci_port_init(63 ret = uhci_port_init( 70 64 &instance->ports[i], regs + i, i, ROOT_HUB_WAIT_USEC, rh); 71 65 if (ret != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.