Changeset 233e68d in mainline for uspace/drv/uhci-hcd/uhci.c
- Timestamp:
- 2011-02-23T18:28:41Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e9e58ea3
- Parents:
- deece2f (diff), a9c674e0 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/uhci.c
rdeece2f r233e68d 33 33 */ 34 34 #include <errno.h> 35 #include <str_error.h> 35 36 #include <adt/list.h> 37 #include <libarch/ddi.h> 36 38 37 39 #include <usb/debug.h> 38 40 #include <usb/usb.h> 41 #include <usb/ddfiface.h> 42 #include <usb_iface.h> 39 43 40 44 #include "uhci.h" 45 #include "iface.h" 46 41 47 static irq_cmd_t uhci_cmds[] = { 42 48 { … … 55 61 }; 56 62 63 static int usb_iface_get_address(ddf_fun_t *fun, devman_handle_t handle, 64 usb_address_t *address) 65 { 66 assert(fun); 67 uhci_t *hc = fun_to_uhci(fun); 68 assert(hc); 69 70 usb_address_t addr = usb_address_keeping_find(&hc->address_manager, 71 handle); 72 if (addr < 0) { 73 return addr; 74 } 75 76 if (address != NULL) { 77 *address = addr; 78 } 79 80 return EOK; 81 } 82 83 84 static usb_iface_t hc_usb_iface = { 85 .get_hc_handle = usb_iface_get_hc_handle_hc_impl, 86 .get_address = usb_iface_get_address 87 }; 88 /*----------------------------------------------------------------------------*/ 89 static ddf_dev_ops_t uhci_ops = { 90 .interfaces[USB_DEV_IFACE] = &hc_usb_iface, 91 .interfaces[USBHC_DEV_IFACE] = &uhci_iface 92 }; 93 57 94 static int uhci_init_transfer_lists(uhci_t *instance); 58 95 static int uhci_init_mem_structures(uhci_t *instance); … … 71 108 } else (void) 0 72 109 73 int uhci_init(uhci_t *instance, void *regs, size_t reg_size)110 int uhci_init(uhci_t *instance, ddf_dev_t *dev, void *regs, size_t reg_size) 74 111 { 75 112 assert(reg_size >= sizeof(regs_t)); 113 int ret; 114 115 /* 116 * Create UHCI function. 117 */ 118 instance->ddf_instance = ddf_fun_create(dev, fun_exposed, "uhci"); 119 if (instance->ddf_instance == NULL) { 120 usb_log_error("Failed to create UHCI device function.\n"); 121 return ENOMEM; 122 } 123 instance->ddf_instance->ops = &uhci_ops; 124 instance->ddf_instance->driver_data = instance; 125 126 ret = ddf_fun_bind(instance->ddf_instance); 127 CHECK_RET_RETURN(ret, "Failed to bind UHCI device function: %s.\n", 128 str_error(ret)); 76 129 77 130 /* allow access to hc control registers */ 78 131 regs_t *io; 79 intret = pio_enable(regs, reg_size, (void**)&io);132 ret = pio_enable(regs, reg_size, (void**)&io); 80 133 CHECK_RET_RETURN(ret, "Failed to gain access to registers at %p.\n", io); 81 134 instance->registers = io;
Note:
See TracChangeset
for help on using the changeset viewer.