Changeset 12b8e03 in mainline
- Timestamp:
- 2011-04-14T13:59:04Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0146d41, 8fb3981
- Parents:
- fa0f53b (diff), 8d517c3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/drv
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/ohci_regs.h
rfa0f53b r12b8e03 55 55 #define C_HCFS_MASK (0x3) /* Host controller functional state */ 56 56 #define C_HCFS_RESET (0x0) 57 #define C_HCFS_ OPERATIONAL(0x1)58 #define C_HCFS_ RESUME(0x2)57 #define C_HCFS_RESUME (0x1) 58 #define C_HCFS_OPERATIONAL (0x2) 59 59 #define C_HCFS_SUSPEND (0x3) 60 60 #define C_HCFS_SHIFT (6) -
uspace/drv/uhci-hcd/hc.c
rfa0f53b r12b8e03 247 247 { 248 248 assert(instance); 249 #define CHECK_RET_CLEAR_RETURN(ret, message...) \ 249 #define SETUP_TRANSFER_LIST(type, name) \ 250 do { \ 251 int ret = transfer_list_init(&instance->transfers_##type, name); \ 250 252 if (ret != EOK) { \ 251 usb_log_error(message); \ 253 usb_log_error("Failed(%d) to setup %s transfer list: %s.\n", \ 254 ret, name, str_error(ret)); \ 252 255 transfer_list_fini(&instance->transfers_bulk_full); \ 253 256 transfer_list_fini(&instance->transfers_control_full); \ … … 255 258 transfer_list_fini(&instance->transfers_interrupt); \ 256 259 return ret; \ 257 } else (void) 0 258 259 /* initialize TODO: check errors */ 260 int ret; 261 ret = transfer_list_init(&instance->transfers_bulk_full, "BULK_FULL"); 262 CHECK_RET_CLEAR_RETURN(ret, "Failed to init BULK list."); 263 264 ret = transfer_list_init( 265 &instance->transfers_control_full, "CONTROL_FULL"); 266 CHECK_RET_CLEAR_RETURN(ret, "Failed to init CONTROL FULL list."); 267 268 ret = transfer_list_init( 269 &instance->transfers_control_slow, "CONTROL_SLOW"); 270 CHECK_RET_CLEAR_RETURN(ret, "Failed to init CONTROL SLOW list."); 271 272 ret = transfer_list_init(&instance->transfers_interrupt, "INTERRUPT"); 273 CHECK_RET_CLEAR_RETURN(ret, "Failed to init INTERRUPT list."); 274 260 } \ 261 } while (0) 262 263 SETUP_TRANSFER_LIST(bulk_full, "BULK FULL"); 264 SETUP_TRANSFER_LIST(control_full, "CONTROL FULL"); 265 SETUP_TRANSFER_LIST(control_slow, "CONTROL LOW"); 266 SETUP_TRANSFER_LIST(interrupt, "INTERRUPT"); 267 #undef SETUP_TRANSFER_LIST 268 /* Connect lists into one schedule */ 275 269 transfer_list_set_next(&instance->transfers_control_full, 276 270 &instance->transfers_bulk_full); … … 337 331 assert(instance); 338 332 // status |= 1; //Uncomment to work around qemu hang 339 /* TODO: Resume interrupts are not supported */340 333 /* Lower 2 bits are transaction error and transaction complete */ 341 if (status & 0x3) {334 if (status & (UHCI_STATUS_INTERRUPT | UHCI_STATUS_ERROR_INTERRUPT)) { 342 335 LIST_INITIALIZE(done); 343 336 transfer_list_remove_finished( … … 358 351 } 359 352 } 360 /* bits 4 and 5 indicate hc error */ 361 if (status & 0x18) { 353 /* Resume interrupts are not supported */ 354 355 /* Bits 4 and 5 indicate hc error */ 356 if (status & (UHCI_STATUS_PROCESS_ERROR | UHCI_STATUS_SYSTEM_ERROR)) { 362 357 usb_log_error("UHCI hardware failure!.\n"); 363 358 ++instance->hw_failures; … … 389 384 390 385 while (1) { 391 /* read and ack interrupts*/386 /* Readd and clear status register */ 392 387 uint16_t status = pio_read_16(&instance->registers->usbsts); 393 pio_write_16(&instance->registers->usbsts, 0x1f);388 pio_write_16(&instance->registers->usbsts, status); 394 389 if (status != 0) 395 390 usb_log_debug2("UHCI status: %x.\n", status); 396 391 hc_interrupt(instance, status); 397 async_usleep(UHCI_ CLEANER_TIMEOUT);392 async_usleep(UHCI_INT_EMULATOR_TIMEOUT); 398 393 } 399 394 return EOK; -
uspace/drv/uhci-hcd/hc.h
rfa0f53b r12b8e03 88 88 89 89 #define UHCI_FRAME_LIST_COUNT 1024 90 #define UHCI_ CLEANER_TIMEOUT 1000090 #define UHCI_INT_EMULATOR_TIMEOUT 10000 91 91 #define UHCI_DEBUGER_TIMEOUT 5000000 92 92 #define UHCI_ALLOWED_HW_FAIL 5 -
uspace/drv/uhci-hcd/main.c
rfa0f53b r12b8e03 78 78 device->driver_data = uhci; 79 79 80 usb_log_info("Controlling new UHCI device `%s'.\n", device->name);80 usb_log_info("Controlling new UHCI device '%s'.\n", device->name); 81 81 82 82 return EOK; -
uspace/drv/uhci-rhd/port.c
rfa0f53b r12b8e03 68 68 * @return Error code. (Always EOK) 69 69 */ 70 static inline void uhci_port_write_status( 71 uhci_port_t *port, port_status_t value) 72 { 73 assert(port); 74 pio_write_16(port->address, value); 70 static inline void uhci_port_write_status(uhci_port_t *port, port_status_t val) 71 { 72 assert(port); 73 pio_write_16(port->address, val); 75 74 } 76 75 /*----------------------------------------------------------------------------*/ … … 101 100 port->rh = rh; 102 101 103 int r c = usb_hc_connection_initialize_from_device(104 &port->hc_connection, rh);105 if (r c!= EOK) {102 int ret = 103 usb_hc_connection_initialize_from_device(&port->hc_connection, rh); 104 if (ret != EOK) { 106 105 usb_log_error("Failed to initialize connection to HC."); 107 return r c;106 return ret; 108 107 } 109 108 … … 238 237 /* Enable the port. */ 239 238 uhci_port_set_enabled(port, true); 240 241 239 return EOK; 242 240 } … … 271 269 usb_log_info("New device at port %u, address %d (handle %llu).\n", 272 270 port->number, dev_addr, port->attached_device); 273 274 271 return EOK; 275 272 } … … 313 310 /* Write new value. */ 314 311 uhci_port_write_status(port, port_status); 312 313 /* Wait for port to become enabled */ 314 do { 315 async_usleep(1000); 316 port_status = uhci_port_read_status(port); 317 } while ((port_status & STATUS_CONNECTED) && 318 !(port_status & STATUS_ENABLED)); 315 319 316 320 usb_log_debug("%s: %sabled port.\n", -
uspace/drv/uhci-rhd/port.h
rfa0f53b r12b8e03 54 54 #define STATUS_SUSPEND (1 << 12) 55 55 56 /** UHCI port structure */ 56 57 typedef struct uhci_port 57 58 { -
uspace/drv/uhci-rhd/root_hub.c
rfa0f53b r12b8e03 33 33 */ 34 34 #include <errno.h> 35 #include <str_error.h> 35 36 #include <ddi.h> 36 37 #include <usb/debug.h> … … 43 44 * @param[in] addr Address of I/O registers. 44 45 * @param[in] size Size of available I/O space. 45 * @param[in] rh Pointer to ddfinstance of the root hub driver.46 * @param[in] rh Pointer to DDF instance of the root hub driver. 46 47 * @return Error code. 47 48 */ … … 58 59 if (ret < 0) { 59 60 usb_log_error( 60 "Failed(%d) to gain access to port registers at %p \n",61 ret, regs );61 "Failed(%d) to gain access to port registers at %p: %s.\n", 62 ret, regs, str_error(ret)); 62 63 return ret; 63 64 } … … 66 67 unsigned i = 0; 67 68 for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) { 68 /* NOTE: mind pointer arithmetics here */69 69 ret = uhci_port_init( 70 &instance->ports[i], regs + i, i, ROOT_HUB_WAIT_USEC, rh);70 &instance->ports[i], ®s[i], i, ROOT_HUB_WAIT_USEC, rh); 71 71 if (ret != EOK) { 72 72 unsigned j = 0; -
uspace/drv/uhci-rhd/root_hub.h
rfa0f53b r12b8e03 42 42 #define ROOT_HUB_WAIT_USEC 250000 /* 250 miliseconds */ 43 43 44 /** UHCI root hub drvier structure */ 44 45 typedef struct root_hub { 46 /** Ports provided by the hub */ 45 47 uhci_port_t ports[UHCI_ROOT_HUB_PORT_COUNT]; 46 devman_handle_t hc_handle;47 48 } uhci_root_hub_t; 48 49 49 50 int uhci_root_hub_init( 50 uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh);51 uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh); 51 52 52 53 void uhci_root_hub_fini(uhci_root_hub_t *instance);
Note:
See TracChangeset
for help on using the changeset viewer.