Changeset 62d9827 in mainline
- Timestamp:
- 2011-01-29T07:54:54Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 816175a2
- Parents:
- 86b39f7e
- Location:
- uspace/drv/uhci/root_hub
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci/root_hub/port.c
r86b39f7e r62d9827 1 1 2 2 #include <errno.h> 3 //#include <usb/devreq.h> /* for usb_device_request_setup_packet_t */4 3 #include <usb/usb.h> 5 4 #include <usb/usbdrv.h> 6 5 7 6 #include "debug.h" 8 #include "uhci.h"9 7 #include "port.h" 10 8 #include "port_status.h" … … 50 48 { 51 49 assert(port); 52 assert(port->hc );50 assert(port->hc_phone); 53 51 54 52 uhci_print_info("Adding new device on port %d.\n", port->number); 55 53 56 uhci_t *uhci_instance = (uhci_t*)(port->hc->driver_data);57 54 58 55 /* get default address */ 59 usb_address_keeping_reserve_default(&uhci_instance->address_manager); 56 int ret = usb_drv_reserve_default_address(port->hc_phone); 57 if (ret != EOK) { 58 uhci_print_error("Failed to reserve default address.\n"); 59 return ret; 60 } 60 61 61 const usb_address_t usb_address = 62 usb_address_keeping_request(&uhci_instance->address_manager); 62 const usb_address_t usb_address = usb_drv_request_address(port->hc_phone); 63 63 64 64 if (usb_address <= 0) { 65 uhci_print_error("Recieved invalid address(%d).\n", usb_address); 65 66 return usb_address; 66 67 } … … 88 89 89 90 /* assign address to device */ 90 intret = usb_drv_req_set_address(port->hc_phone, 0, usb_address);91 ret = usb_drv_req_set_address(port->hc_phone, 0, usb_address); 91 92 92 93 … … 94 95 uhci_print_error("Failed(%d) to assign address to the device.\n", ret); 95 96 uhci_port_set_enabled(port, false); 96 usb_address_keeping_release_default(&uhci_instance->address_manager); 97 return ENOMEM; 97 int release = usb_drv_release_default_address(port->hc_phone); 98 if (release != EOK) { 99 uhci_print_fatal("Failed to release default address.\n"); 100 return release; 101 } 102 return ret; 98 103 } 99 104 100 105 /* release default address */ 101 usb_address_keeping_release_default(&uhci_instance->address_manager); 106 ret = usb_drv_release_default_address(port->hc_phone); 107 if (ret != EOK) { 108 uhci_print_fatal("Failed to release default address.\n"); 109 return ret; 110 } 102 111 103 112 /* communicate and possibly report to devman */ … … 113 122 } 114 123 124 /* TODO: bind the address here */ 125 115 126 return EOK; 116 127 } … … 119 130 { 120 131 uhci_print_error("Don't know how to remove device %#x.\n", 121 port->attached_device);132 (unsigned int)port->attached_device); 122 133 uhci_port_set_enabled(port, false); 123 134 return EOK; -
uspace/drv/uhci/root_hub/root_hub.c
r86b39f7e r62d9827 12 12 int uhci_root_hub_init( uhci_root_hub_t *hub, device_t *hc, void *addr ) 13 13 { 14 assert( hub);14 assert(hub); 15 15 16 16 /* allow access to root hub registers */
Note:
See TracChangeset
for help on using the changeset viewer.