Changeset 36a4738 in mainline for uspace/drv/uhci-hcd/main.c
- Timestamp:
- 2011-02-16T21:30:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30a4301
- Parents:
- 9013ad3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/main.c
r9013ad3 r36a4738 46 46 #define NAME "uhci-hcd" 47 47 48 static int uhci_add_device(device_t *device); 49 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle); 50 /*----------------------------------------------------------------------------*/ 48 51 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle) 49 52 { … … 54 57 return EOK; 55 58 } 56 59 /*----------------------------------------------------------------------------*/ 57 60 static usb_iface_t hc_usb_iface = { 58 61 .get_hc_handle = usb_iface_get_hc_handle 59 62 }; 60 63 /*----------------------------------------------------------------------------*/ 61 64 static device_ops_t uhci_ops = { 62 65 .interfaces[USB_DEV_IFACE] = &hc_usb_iface, 63 66 .interfaces[USBHC_DEV_IFACE] = &uhci_iface 64 67 }; 65 68 /*----------------------------------------------------------------------------*/ 69 static driver_ops_t uhci_driver_ops = { 70 .add_device = uhci_add_device, 71 }; 72 /*----------------------------------------------------------------------------*/ 73 static driver_t uhci_driver = { 74 .name = NAME, 75 .driver_ops = &uhci_driver_ops 76 }; 77 /*----------------------------------------------------------------------------*/ 78 static void irq_handler(device_t *dev, ipc_callid_t iid, ipc_call_t *call) 79 { 80 usb_log_error("LOL interrupt %x %x.\n", iid, call); 81 } 82 /*----------------------------------------------------------------------------*/ 66 83 static int uhci_add_device(device_t *device) 67 84 { … … 75 92 int irq; 76 93 77 int r c= pci_get_my_registers(device,94 int ret = pci_get_my_registers(device, 78 95 &io_reg_base, &io_reg_size, &irq); 79 96 80 if (r c!= EOK) {97 if (ret != EOK) { 81 98 usb_log_error("Failed(%d) to get I/O registers addresses for device:.\n", 82 r c, device->handle);83 return r c;99 ret, device->handle); 100 return ret; 84 101 } 85 102 … … 89 106 uhci_t *uhci_hc = malloc(sizeof(uhci_t)); 90 107 if (!uhci_hc) { 91 usb_log_error("Failed to alloca ete memory for uhci hcd driver.\n");108 usb_log_error("Failed to allocate memory for uhci hcd driver.\n"); 92 109 return ENOMEM; 93 110 } 94 111 95 intret = uhci_init(uhci_hc, (void*)io_reg_base, io_reg_size);112 ret = uhci_init(uhci_hc, (void*)io_reg_base, io_reg_size); 96 113 if (ret != EOK) { 97 114 usb_log_error("Failed to init uhci-hcd.\n"); … … 100 117 device_t *rh; 101 118 ret = setup_root_hub(&rh, device); 102 103 119 if (ret != EOK) { 104 120 usb_log_error("Failed to setup uhci root hub.\n"); … … 116 132 device->driver_data = uhci_hc; 117 133 134 ret = register_interrupt_handler(device, irq, irq_handler, NULL); 135 usb_log_error("registered interrupt handler %d.\n", ret); 136 118 137 return EOK; 119 138 } 120 121 static driver_ops_t uhci_driver_ops = { 122 .add_device = uhci_add_device, 123 }; 124 125 static driver_t uhci_driver = { 126 .name = NAME, 127 .driver_ops = &uhci_driver_ops 128 }; 129 139 /*----------------------------------------------------------------------------*/ 130 140 int main(int argc, char *argv[]) 131 141 { 132 /* 133 * Do some global initializations. 134 */ 135 sleep(5); 136 usb_log_enable(USB_LOG_LEVEL_INFO, NAME); 142 sleep(3); 143 usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME); 137 144 138 145 return driver_main(&uhci_driver);
Note:
See TracChangeset
for help on using the changeset viewer.