Changeset 6a44ee4 in mainline for uspace/drv
- Timestamp:
- 2011-07-20T15:26:21Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- efcebe1
- Parents:
- 25bef0ff (diff), a701812 (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:
-
- 140 added
- 34 moved
-
bus/isa/Makefile (moved) (moved from uspace/drv/isa/Makefile ) (1 diff)
-
bus/isa/isa.c (moved) (moved from uspace/drv/isa/isa.c ) (1 diff)
-
bus/isa/isa.dev (moved) (moved from uspace/drv/isa/isa.dev )
-
bus/isa/isa.ma (moved) (moved from uspace/drv/isa/isa.ma )
-
bus/pci/pciintel/Makefile (moved) (moved from uspace/drv/pciintel/Makefile ) (1 diff)
-
bus/pci/pciintel/pci.c (moved) (moved from uspace/drv/pciintel/pci.c ) (12 diffs)
-
bus/pci/pciintel/pci.h (moved) (moved from uspace/drv/pciintel/pci.h )
-
bus/pci/pciintel/pci_regs.h (moved) (moved from uspace/drv/pciintel/pci_regs.h )
-
bus/pci/pciintel/pciintel.ma (moved) (moved from uspace/drv/pciintel/pciintel.ma )
-
bus/usb/ehci/Makefile (added)
-
bus/usb/ehci/ehci.h (moved) (moved from uspace/lib/c/include/ipc/mouse.h ) (2 diffs)
-
bus/usb/ehci/ehci.ma (added)
-
bus/usb/ehci/hc_iface.c (added)
-
bus/usb/ehci/main.c (added)
-
bus/usb/ehci/pci.c (added)
-
bus/usb/ehci/pci.h (added)
-
bus/usb/ohci/Makefile (added)
-
bus/usb/ohci/batch.c (added)
-
bus/usb/ohci/batch.h (added)
-
bus/usb/ohci/endpoint_list.c (added)
-
bus/usb/ohci/endpoint_list.h (added)
-
bus/usb/ohci/hc.c (added)
-
bus/usb/ohci/hc.h (added)
-
bus/usb/ohci/hcd_endpoint.c (added)
-
bus/usb/ohci/hcd_endpoint.h (added)
-
bus/usb/ohci/hw_struct/completion_codes.h (added)
-
bus/usb/ohci/hw_struct/endpoint_descriptor.c (added)
-
bus/usb/ohci/hw_struct/endpoint_descriptor.h (added)
-
bus/usb/ohci/hw_struct/hcca.h (added)
-
bus/usb/ohci/hw_struct/iso_transfer_descriptor.h (added)
-
bus/usb/ohci/hw_struct/transfer_descriptor.c (added)
-
bus/usb/ohci/hw_struct/transfer_descriptor.h (added)
-
bus/usb/ohci/iface.c (added)
-
bus/usb/ohci/iface.h (added)
-
bus/usb/ohci/main.c (added)
-
bus/usb/ohci/ohci.c (added)
-
bus/usb/ohci/ohci.h (added)
-
bus/usb/ohci/ohci.ma (added)
-
bus/usb/ohci/ohci_regs.h (added)
-
bus/usb/ohci/pci.c (added)
-
bus/usb/ohci/pci.h (added)
-
bus/usb/ohci/root_hub.c (added)
-
bus/usb/ohci/root_hub.h (added)
-
bus/usb/ohci/utils/malloc32.h (added)
-
bus/usb/uhci/Makefile (added)
-
bus/usb/uhci/batch.c (added)
-
bus/usb/uhci/batch.h (added)
-
bus/usb/uhci/hc.c (added)
-
bus/usb/uhci/hc.h (added)
-
bus/usb/uhci/hw_struct/link_pointer.h (added)
-
bus/usb/uhci/hw_struct/queue_head.h (added)
-
bus/usb/uhci/hw_struct/transfer_descriptor.c (added)
-
bus/usb/uhci/hw_struct/transfer_descriptor.h (added)
-
bus/usb/uhci/iface.c (added)
-
bus/usb/uhci/iface.h (added)
-
bus/usb/uhci/main.c (added)
-
bus/usb/uhci/pci.c (added)
-
bus/usb/uhci/pci.h (added)
-
bus/usb/uhci/root_hub.c (added)
-
bus/usb/uhci/root_hub.h (added)
-
bus/usb/uhci/transfer_list.c (added)
-
bus/usb/uhci/transfer_list.h (added)
-
bus/usb/uhci/uhci.c (added)
-
bus/usb/uhci/uhci.h (moved) (moved from uspace/srv/hid/char_mouse/include/char_mouse.h ) (2 diffs)
-
bus/usb/uhci/uhci.ma (added)
-
bus/usb/uhci/utils/malloc32.h (added)
-
bus/usb/uhcirh/Makefile (added)
-
bus/usb/uhcirh/main.c (added)
-
bus/usb/uhcirh/port.c (added)
-
bus/usb/uhcirh/port.h (added)
-
bus/usb/uhcirh/root_hub.c (added)
-
bus/usb/uhcirh/root_hub.h (added)
-
bus/usb/uhcirh/uhcirh.ma (added)
-
bus/usb/usbflbk/Makefile (added)
-
bus/usb/usbflbk/main.c (added)
-
bus/usb/usbflbk/usbflbk.ma (added)
-
bus/usb/usbhid/Makefile (added)
-
bus/usb/usbhid/generic/hiddev.c (added)
-
bus/usb/usbhid/generic/hiddev.h (added)
-
bus/usb/usbhid/kbd/conv.c (added)
-
bus/usb/usbhid/kbd/conv.h (added)
-
bus/usb/usbhid/kbd/kbddev.c (added)
-
bus/usb/usbhid/kbd/kbddev.h (added)
-
bus/usb/usbhid/kbd/kbdrepeat.c (added)
-
bus/usb/usbhid/kbd/kbdrepeat.h (added)
-
bus/usb/usbhid/main.c (added)
-
bus/usb/usbhid/mouse/mousedev.c (added)
-
bus/usb/usbhid/mouse/mousedev.h (added)
-
bus/usb/usbhid/multimedia/keymap.c (added)
-
bus/usb/usbhid/multimedia/keymap.h (added)
-
bus/usb/usbhid/multimedia/multimedia.c (added)
-
bus/usb/usbhid/multimedia/multimedia.h (added)
-
bus/usb/usbhid/subdrivers.c (added)
-
bus/usb/usbhid/subdrivers.h (added)
-
bus/usb/usbhid/usbhid.c (added)
-
bus/usb/usbhid/usbhid.h (added)
-
bus/usb/usbhid/usbhid.ma (added)
-
bus/usb/usbhub/Makefile (added)
-
bus/usb/usbhub/main.c (moved) (moved from uspace/srv/hid/adb_mouse/adb_dev.c ) (3 diffs)
-
bus/usb/usbhub/port_status.h (added)
-
bus/usb/usbhub/ports.c (added)
-
bus/usb/usbhub/ports.h (added)
-
bus/usb/usbhub/usbhub.c (added)
-
bus/usb/usbhub/usbhub.h (added)
-
bus/usb/usbhub/usbhub.ma (added)
-
bus/usb/usbhub/usbhub_private.h (added)
-
bus/usb/usbhub/utils.c (added)
-
bus/usb/usbmast/Makefile (added)
-
bus/usb/usbmast/bo_trans.c (added)
-
bus/usb/usbmast/bo_trans.h (added)
-
bus/usb/usbmast/cmdw.c (added)
-
bus/usb/usbmast/cmdw.h (added)
-
bus/usb/usbmast/main.c (added)
-
bus/usb/usbmast/scsi_ms.c (added)
-
bus/usb/usbmast/scsi_ms.h (added)
-
bus/usb/usbmast/usbmast.h (added)
-
bus/usb/usbmast/usbmast.ma (added)
-
bus/usb/usbmid/Makefile (added)
-
bus/usb/usbmid/dump.c (added)
-
bus/usb/usbmid/explore.c (added)
-
bus/usb/usbmid/main.c (added)
-
bus/usb/usbmid/usbmid.c (added)
-
bus/usb/usbmid/usbmid.h (added)
-
bus/usb/usbmid/usbmid.ma (added)
-
bus/usb/usbmouse/Makefile (added)
-
bus/usb/usbmouse/init.c (added)
-
bus/usb/usbmouse/main.c (added)
-
bus/usb/usbmouse/mouse.c (added)
-
bus/usb/usbmouse/mouse.h (added)
-
bus/usb/usbmouse/usbmouse.ma (added)
-
bus/usb/vhc/Makefile (added)
-
bus/usb/vhc/conn.h (added)
-
bus/usb/vhc/conndev.c (added)
-
bus/usb/vhc/connhost.c (added)
-
bus/usb/vhc/devconn.c (added)
-
bus/usb/vhc/hub.c (added)
-
bus/usb/vhc/hub.h (added)
-
bus/usb/vhc/hub/hub.c (added)
-
bus/usb/vhc/hub/hub.h (added)
-
bus/usb/vhc/hub/virthub.c (added)
-
bus/usb/vhc/hub/virthub.h (added)
-
bus/usb/vhc/hub/virthubops.c (added)
-
bus/usb/vhc/main.c (added)
-
bus/usb/vhc/transfer.c (added)
-
bus/usb/vhc/vhc.ma (added)
-
bus/usb/vhc/vhcd.h (added)
-
char/ns8250/Makefile (moved) (moved from uspace/drv/ns8250/Makefile ) (1 diff)
-
char/ns8250/cyclic_buffer.h (moved) (moved from uspace/drv/ns8250/cyclic_buffer.h )
-
char/ns8250/ns8250.c (moved) (moved from uspace/drv/ns8250/ns8250.c ) (2 diffs)
-
char/ns8250/ns8250.ma (moved) (moved from uspace/drv/ns8250/ns8250.ma )
-
infrastructure/root/Makefile (moved) (moved from uspace/drv/root/Makefile ) (1 diff)
-
infrastructure/root/root.c (moved) (moved from uspace/drv/root/root.c ) (1 diff)
-
infrastructure/root/root.ma (moved) (moved from uspace/drv/root/root.ma )
-
infrastructure/rootmac/Makefile (added)
-
infrastructure/rootmac/rootmac.c (added)
-
infrastructure/rootmac/rootmac.ma (added)
-
infrastructure/rootpc/Makefile (moved) (moved from uspace/drv/rootpc/Makefile ) (1 diff)
-
infrastructure/rootpc/rootpc.c (moved) (moved from uspace/drv/rootpc/rootpc.c )
-
infrastructure/rootpc/rootpc.ma (moved) (moved from uspace/drv/rootpc/rootpc.ma )
-
infrastructure/rootvirt/Makefile (moved) (moved from uspace/drv/rootvirt/Makefile ) (1 diff)
-
infrastructure/rootvirt/devices.def (moved) (moved from uspace/drv/rootvirt/devices.def ) (1 diff)
-
infrastructure/rootvirt/rootvirt.c (moved) (moved from uspace/drv/rootvirt/rootvirt.c )
-
infrastructure/rootvirt/rootvirt.ma (moved) (moved from uspace/drv/rootvirt/rootvirt.ma )
-
test/test1/Makefile (moved) (moved from uspace/drv/test1/Makefile ) (1 diff)
-
test/test1/char.c (moved) (moved from uspace/drv/test1/char.c )
-
test/test1/test1.c (moved) (moved from uspace/drv/test1/test1.c ) (1 diff)
-
test/test1/test1.h (moved) (moved from uspace/drv/test1/test1.h )
-
test/test1/test1.ma (moved) (moved from uspace/drv/test1/test1.ma )
-
test/test2/Makefile (moved) (moved from uspace/drv/test2/Makefile ) (1 diff)
-
test/test2/test2.c (moved) (moved from uspace/drv/test2/test2.c )
-
test/test2/test2.ma (moved) (moved from uspace/drv/test2/test2.ma )
-
test/test3/Makefile (added)
-
test/test3/test3.c (added)
-
test/test3/test3.ma (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/isa/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -
uspace/drv/bus/isa/isa.c
r25bef0ff r6a44ee4 352 352 str_error(rc)); 353 353 } 354 355 free(id); 354 356 } 355 357 -
uspace/drv/bus/pci/pciintel/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -
uspace/drv/bus/pci/pciintel/pci.c
r25bef0ff r6a44ee4 52 52 #include <ipc/devman.h> 53 53 #include <ipc/dev_iface.h> 54 #include <ipc/irc.h> 55 #include <ns.h> 56 #include <ipc/services.h> 57 #include <sysinfo.h> 54 58 #include <ops/hw_res.h> 55 59 #include <device/hw_res.h> 56 60 #include <ddi.h> 57 61 #include <libarch/ddi.h> 62 #include <pci_dev_iface.h> 58 63 59 64 #include "pci.h" … … 84 89 static bool pciintel_enable_interrupt(ddf_fun_t *fnode) 85 90 { 86 /* TODO */ 87 88 return false; 91 /* This is an old ugly way, copied from ne2000 driver */ 92 assert(fnode); 93 pci_fun_t *dev_data = (pci_fun_t *) fnode->driver_data; 94 95 sysarg_t apic; 96 sysarg_t i8259; 97 98 async_sess_t *irc_sess = NULL; 99 100 if (((sysinfo_get_value("apic", &apic) == EOK) && (apic)) 101 || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) { 102 irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 103 SERVICE_IRC, 0, 0); 104 } 105 106 if (!irc_sess) 107 return false; 108 109 size_t i = 0; 110 hw_resource_list_t *res = &dev_data->hw_resources; 111 for (; i < res->count; i++) { 112 if (res->resources[i].type == INTERRUPT) { 113 const int irq = res->resources[i].res.interrupt.irq; 114 115 async_exch_t *exch = async_exchange_begin(irc_sess); 116 const int rc = 117 async_req_1_0(exch, IRC_ENABLE_INTERRUPT, irq); 118 async_exchange_end(exch); 119 120 if (rc != EOK) { 121 async_hangup(irc_sess); 122 return false; 123 } 124 } 125 } 126 127 async_hangup(irc_sess); 128 return true; 129 } 130 131 static int pci_config_space_write_32(ddf_fun_t *fun, uint32_t address, 132 uint32_t data) 133 { 134 if (address > 252) 135 return EINVAL; 136 pci_conf_write_32(PCI_FUN(fun), address, data); 137 return EOK; 138 } 139 140 static int pci_config_space_write_16( 141 ddf_fun_t *fun, uint32_t address, uint16_t data) 142 { 143 if (address > 254) 144 return EINVAL; 145 pci_conf_write_16(PCI_FUN(fun), address, data); 146 return EOK; 147 } 148 149 static int pci_config_space_write_8( 150 ddf_fun_t *fun, uint32_t address, uint8_t data) 151 { 152 if (address > 255) 153 return EINVAL; 154 pci_conf_write_8(PCI_FUN(fun), address, data); 155 return EOK; 156 } 157 158 static int pci_config_space_read_32( 159 ddf_fun_t *fun, uint32_t address, uint32_t *data) 160 { 161 if (address > 252) 162 return EINVAL; 163 *data = pci_conf_read_32(PCI_FUN(fun), address); 164 return EOK; 165 } 166 167 static int pci_config_space_read_16( 168 ddf_fun_t *fun, uint32_t address, uint16_t *data) 169 { 170 if (address > 254) 171 return EINVAL; 172 *data = pci_conf_read_16(PCI_FUN(fun), address); 173 return EOK; 174 } 175 176 static int pci_config_space_read_8( 177 ddf_fun_t *fun, uint32_t address, uint8_t *data) 178 { 179 if (address > 255) 180 return EINVAL; 181 *data = pci_conf_read_8(PCI_FUN(fun), address); 182 return EOK; 89 183 } 90 184 … … 94 188 }; 95 189 96 static ddf_dev_ops_t pci_fun_ops; 190 static pci_dev_iface_t pci_dev_ops = { 191 .config_space_read_8 = &pci_config_space_read_8, 192 .config_space_read_16 = &pci_config_space_read_16, 193 .config_space_read_32 = &pci_config_space_read_32, 194 .config_space_write_8 = &pci_config_space_write_8, 195 .config_space_write_16 = &pci_config_space_write_16, 196 .config_space_write_32 = &pci_config_space_write_32 197 }; 198 199 static ddf_dev_ops_t pci_fun_ops = { 200 .interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops, 201 .interfaces[PCI_DEV_IFACE] = &pci_dev_ops 202 }; 97 203 98 204 static int pci_add_device(ddf_dev_t *); … … 236 342 } 237 343 344 free(match_id_str); 345 238 346 /* TODO add more ids (with subsys ids, using class id etc.) */ 239 347 } … … 288 396 /* Get the value of the BAR. */ 289 397 val = pci_conf_read_32(fun, addr); 398 399 #define IO_MASK (~0x3) 400 #define MEM_MASK (~0xf) 290 401 291 402 io = (bool) (val & 1); 292 403 if (io) { 293 404 addrw64 = false; 405 mask = IO_MASK; 294 406 } else { 407 mask = MEM_MASK; 295 408 switch ((val >> 1) & 3) { 296 409 case 0: … … 308 421 /* Get the address mask. */ 309 422 pci_conf_write_32(fun, addr, 0xffffffff); 310 mask = pci_conf_read_32(fun, addr);423 mask &= pci_conf_read_32(fun, addr); 311 424 312 425 /* Restore the original value. */ … … 469 582 470 583 ddf_msg(LVL_DEBUG, "pci_add_device"); 471 dnode->parent_ phone = -1;584 dnode->parent_sess = NULL; 472 585 473 586 bus = pci_bus_new(); … … 480 593 dnode->driver_data = bus; 481 594 482 dnode->parent_ phone = devman_parent_device_connect(dnode->handle,483 IPC_FLAG_BLOCKING);484 if ( dnode->parent_phone < 0) {595 dnode->parent_sess = devman_parent_device_connect(EXCHANGE_SERIALIZE, 596 dnode->handle, IPC_FLAG_BLOCKING); 597 if (!dnode->parent_sess) { 485 598 ddf_msg(LVL_ERROR, "pci_add_device failed to connect to the " 486 "parent 'sdriver.");487 rc = dnode->parent_phone;599 "parent driver."); 600 rc = ENOENT; 488 601 goto fail; 489 602 } … … 491 604 hw_resource_list_t hw_resources; 492 605 493 rc = hw_res_get_resource_list(dnode->parent_ phone, &hw_resources);606 rc = hw_res_get_resource_list(dnode->parent_sess, &hw_resources); 494 607 if (rc != EOK) { 495 608 ddf_msg(LVL_ERROR, "pci_add_device failed to get hw resources " … … 544 657 if (bus != NULL) 545 658 pci_bus_delete(bus); 546 if (dnode->parent_phone >= 0) 547 async_hangup(dnode->parent_phone); 659 660 if (dnode->parent_sess) 661 async_hangup(dnode->parent_sess); 662 548 663 if (got_res) 549 664 hw_res_clean_resource_list(&hw_resources); 665 550 666 if (ctl != NULL) 551 667 ddf_fun_destroy(ctl); 552 668 553 669 return rc; 554 670 } … … 558 674 ddf_log_init(NAME, LVL_ERROR); 559 675 pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops; 676 pci_fun_ops.interfaces[PCI_DEV_IFACE] = &pci_dev_ops; 560 677 } 561 678 … … 629 746 size_t pci_bar_mask_to_size(uint32_t mask) 630 747 { 631 return ((mask & 0xfffffff0) ^ 0xffffffff) + 1; 748 size_t size = mask & ~(mask - 1); 749 return size; 632 750 } 633 751 -
uspace/drv/bus/usb/ehci/ehci.h
r25bef0ff r6a44ee4 1 1 /* 2 * Copyright (c) 20 09 Jiri Svoboda2 * Copyright (c) 2011 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse 30 * @brief 29 /** @addtogroup drvusbehci 31 30 * @{ 32 31 */ 33 32 /** @file 33 * Common EHCI definitions. 34 34 */ 35 #ifndef DRV_EHCI_EHCI_H 36 #define DRV_EHCI_EHCI_H 35 37 36 #ifndef LIBC_IPC_MOUSE_H_ 37 #define LIBC_IPC_MOUSE_H_ 38 #include <usbhc_iface.h> 38 39 39 # include <ipc/common.h>40 #define NAME "ehci" 40 41 41 typedef enum { 42 MEVENT_BUTTON = IPC_FIRST_USER_METHOD, 43 MEVENT_MOVE 44 } mouse_notif_t; 42 extern usbhc_iface_t ehci_hc_iface; 45 43 46 44 #endif 47 48 45 /** 49 46 * @} 50 47 */ 48 -
uspace/drv/bus/usb/uhci/uhci.h
r25bef0ff r6a44ee4 1 1 /* 2 * Copyright (c) 20 09 Jiri Svoboda2 * Copyright (c) 2011 Jan Vesely 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse 30 * @brief 29 /** @addtogroup drvusbuhci 31 30 * @{ 32 31 */ 33 32 /** @file 33 * @brief UHCI driver main structure for both host controller and root-hub. 34 34 */ 35 #ifndef DRV_UHCI_UHCI_H 36 #define DRV_UHCI_UHCI_H 37 #include <ddf/driver.h> 35 38 36 #ifndef CHAR_MOUSE_H_ 37 #define CHAR_MOUSE_H_ 38 39 extern void mouse_handle_byte(int); 40 extern void mouse_ev_btn(int button, int press); 41 extern void mouse_ev_move(int dx, int dy); 42 39 int device_setup_uhci(ddf_dev_t *device); 43 40 #endif 44 45 41 /** 46 42 * @} -
uspace/drv/bus/usb/usbhub/main.c
r25bef0ff r6a44ee4 1 1 /* 2 * Copyright (c) 2010 Jiri Svoboda2 * Copyright (c) 2010 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse29 /** @addtogroup drvusbhub 30 30 * @{ 31 */32 /** @file33 * @brief34 31 */ 35 32 36 #include <ipc/adb.h> 33 #include <ddf/driver.h> 34 #include <errno.h> 37 35 #include <async.h> 38 #include <vfs/vfs.h> 39 #include <fcntl.h> 40 #include <errno.h> 36 #include <stdio.h> 41 37 42 #include "adb_mouse.h"43 #include "adb_dev.h"38 #include <usb/dev/driver.h> 39 #include <usb/classes/classes.h> 44 40 45 static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall); 41 #include "usbhub.h" 42 #include "usbhub_private.h" 46 43 47 static int dev_phone; 44 /** Hub status-change endpoint description. 45 * 46 * For more information see section 11.15.1 of USB 1.1 specification. 47 */ 48 static usb_endpoint_description_t hub_status_change_endpoint_description = { 49 .transfer_type = USB_TRANSFER_INTERRUPT, 50 .direction = USB_DIRECTION_IN, 51 .interface_class = USB_CLASS_HUB, 52 .interface_subclass = 0, 53 .interface_protocol = 0, 54 .flags = 0 55 }; 48 56 49 int adb_dev_init(void) 57 /** 58 * usb hub driver operations 59 * 60 * The most important one is add_device, which is set to usb_hub_add_device. 61 */ 62 static usb_driver_ops_t usb_hub_driver_ops = { 63 .add_device = usb_hub_add_device 64 }; 65 66 /** 67 * hub endpoints, excluding control endpoint 68 */ 69 static usb_endpoint_description_t *usb_hub_endpoints[] = { 70 &hub_status_change_endpoint_description, 71 NULL 72 }; 73 74 /** 75 * static usb hub driver information 76 */ 77 static usb_driver_t usb_hub_driver = { 78 .name = NAME, 79 .ops = &usb_hub_driver_ops, 80 .endpoints = usb_hub_endpoints 81 }; 82 83 84 int main(int argc, char *argv[]) 50 85 { 51 const char *input = "/dev/adb/mouse"; 52 int input_fd; 86 printf(NAME ": HelenOS USB hub driver.\n"); 53 87 54 printf(NAME ": open %s\n", input);88 usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME); 55 89 56 input_fd = open(input, O_RDONLY); 57 if (input_fd < 0) { 58 printf(NAME ": Failed opening %s (%d)\n", input, input_fd); 59 return false; 60 } 61 62 dev_phone = fd_phone(input_fd); 63 if (dev_phone < 0) { 64 printf(NAME ": Failed to connect to device\n"); 65 return false; 66 } 67 68 /* NB: The callback connection is slotted for removal */ 69 if (async_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events) != 0) { 70 printf(NAME ": Failed to create callback from device\n"); 71 return false; 72 } 73 74 return 0; 75 } 76 77 static void adb_dev_events(ipc_callid_t iid, ipc_call_t *icall) 78 { 79 /* Ignore parameters, the connection is already opened */ 80 while (true) { 81 82 ipc_call_t call; 83 ipc_callid_t callid = async_get_call(&call); 84 85 int retval; 86 87 switch (IPC_GET_IMETHOD(call)) { 88 case IPC_M_PHONE_HUNGUP: 89 /* TODO: Handle hangup */ 90 return; 91 case IPC_FIRST_USER_METHOD: 92 mouse_handle_data(IPC_GET_ARG1(call)); 93 break; 94 default: 95 retval = ENOENT; 96 } 97 async_answer_0(callid, retval); 98 } 90 return usb_driver_main(&usb_hub_driver); 99 91 } 100 92 … … 102 94 * @} 103 95 */ 96 -
uspace/drv/char/ns8250/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -
uspace/drv/char/ns8250/ns8250.c
r25bef0ff r6a44ee4 263 263 static void ns8250_dev_cleanup(ns8250_t *ns) 264 264 { 265 if (ns->dev->parent_ phone > 0) {266 async_hangup(ns->dev->parent_ phone);267 ns->dev->parent_ phone = 0;265 if (ns->dev->parent_sess) { 266 async_hangup(ns->dev->parent_sess); 267 ns->dev->parent_sess = NULL; 268 268 } 269 269 } … … 337 337 338 338 /* Connect to the parent's driver. */ 339 ns->dev->parent_ phone = devman_parent_device_connect(ns->dev->handle,340 IPC_FLAG_BLOCKING);341 if ( ns->dev->parent_phone < 0) {339 ns->dev->parent_sess = devman_parent_device_connect(EXCHANGE_SERIALIZE, 340 ns->dev->handle, IPC_FLAG_BLOCKING); 341 if (!ns->dev->parent_sess) { 342 342 ddf_msg(LVL_ERROR, "Failed to connect to parent driver of " 343 343 "device %s.", ns->dev->name); 344 ret = ns->dev->parent_phone;344 ret = ENOENT; 345 345 goto failed; 346 346 } 347 347 348 348 /* Get hw resources. */ 349 ret = hw_res_get_resource_list(ns->dev->parent_ phone, &hw_resources);349 ret = hw_res_get_resource_list(ns->dev->parent_sess, &hw_resources); 350 350 if (ret != EOK) { 351 351 ddf_msg(LVL_ERROR, "Failed to get HW resources for device " -
uspace/drv/infrastructure/root/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -
uspace/drv/infrastructure/root/root.c
r25bef0ff r6a44ee4 176 176 } 177 177 178 free(match_id); 179 178 180 rc = ddf_fun_bind(fun); 179 181 if (rc != EOK) { -
uspace/drv/infrastructure/rootpc/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -
uspace/drv/infrastructure/rootvirt/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -
uspace/drv/infrastructure/rootvirt/devices.def
r25bef0ff r6a44ee4 26 26 }, 27 27 #endif 28 #ifdef CONFIG_RUN_VIRTUAL_USB_HC 29 /* Virtual USB host controller. */ 30 { 31 .name = "usbhc", 32 .match_id = "usb&hc=vhc" 33 }, 34 #endif -
uspace/drv/test/test1/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -
uspace/drv/test/test1/test1.c
r25bef0ff r6a44ee4 74 74 } 75 75 76 rc = ddf_fun_add_match_id(fun, str_dup(match_id), match_score);76 rc = ddf_fun_add_match_id(fun, match_id, match_score); 77 77 if (rc != EOK) { 78 78 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", -
uspace/drv/test/test2/Makefile
r25bef0ff r6a44ee4 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 USPACE_PREFIX = ../../.. 30 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
Note:
See TracChangeset
for help on using the changeset viewer.
