Changeset a40dea3 in mainline
- Timestamp:
- 2011-06-20T20:04:39Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6a0ff7f4
- Parents:
- 5203e256
- Location:
- uspace
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r5203e256 ra40dea3 68 68 generic/clipboard.c \ 69 69 generic/devmap.c \ 70 generic/devmap_obsolete.c \71 70 generic/devman.c \ 72 71 generic/devman_obsolete.c \ -
uspace/srv/hid/adb_mouse/adb_dev.c
r5203e256 ra40dea3 40 40 #include <errno.h> 41 41 #include <devmap.h> 42 #include <devmap_obsolete.h>43 42 #include <async.h> 44 #include <async_obsolete.h>45 43 #include <kernel/ipc/ipc_methods.h> 46 44 … … 53 51 { 54 52 devmap_handle_t handle; 55 int rc = devmap_device_get_handle("adb/mouse", &handle, 53 async_exch_t *exch; 54 int rc; 55 56 rc = devmap_device_get_handle("adb/mouse", &handle, 56 57 IPC_FLAG_BLOCKING); 57 58 58 if (rc != EOK) { 59 59 printf("%s: Failed resolving ADB\n", NAME); … … 61 61 } 62 62 63 int dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING); 64 if (dev_phone < 0) { 63 async_sess_t *dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 64 IPC_FLAG_BLOCKING); 65 if (dev_sess == NULL) { 65 66 printf("%s: Failed connecting to ADB\n", NAME); 66 67 return ENOENT; 67 68 } 68 69 70 exch = async_exchange_begin(dev_sess); 71 if (exch == NULL) { 72 printf("%s: Failed starting exchange with ADB\n", NAME); 73 async_hangup(dev_sess); 74 return ENOMEM; 75 } 76 69 77 /* NB: The callback connection is slotted for removal */ 70 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events, 71 NULL) != 0) { 78 rc = async_connect_to_me(exch, 0, 0, 0, adb_dev_events, NULL); 79 async_exchange_end(exch); 80 81 if (rc != 0) { 72 82 printf(NAME ": Failed to create callback from device\n"); 73 return false; 83 async_hangup(dev_sess); 84 return ENOENT; 74 85 } 75 86 -
uspace/srv/hid/char_mouse/chardev.c
r5203e256 ra40dea3 36 36 #include <ipc/char.h> 37 37 #include <async.h> 38 #include <async_obsolete.h>39 38 #include <vfs/vfs.h> 40 39 #include <fcntl.h> 41 40 #include <errno.h> 42 41 #include <devmap.h> 43 #include <devmap_obsolete.h>44 42 #include <char_mouse.h> 45 43 #include <mouse_port.h> … … 47 45 static void chardev_events(ipc_callid_t iid, ipc_call_t *icall, void *arg); 48 46 49 static int dev_phone;47 static async_sess_t *dev_sess; 50 48 51 49 #define NAME "char_mouse" … … 54 52 { 55 53 devmap_handle_t handle; 56 int rc = devmap_device_get_handle("char/ps2b", &handle, 54 async_exch_t *exch; 55 int rc; 56 57 rc = devmap_device_get_handle("char/ps2b", &handle, 57 58 IPC_FLAG_BLOCKING); 58 59 … … 62 63 } 63 64 64 dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING); 65 if (dev_phone < 0) { 65 dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 66 IPC_FLAG_BLOCKING); 67 if (dev_sess == NULL) { 66 68 printf("%s: Failed connecting to PS/2\n", NAME); 67 69 return ENOENT; 68 70 } 69 71 72 exch = async_exchange_begin(dev_sess); 73 if (exch == NULL) { 74 printf("%s: Failed starting exchange with PS/2\n", NAME); 75 async_hangup(dev_sess); 76 return ENOMEM; 77 } 78 70 79 /* NB: The callback connection is slotted for removal */ 71 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, chardev_events, 72 NULL) != 0) { 80 rc = async_connect_to_me(exch, 0, 0, 0, chardev_events, NULL); 81 async_exchange_end(exch); 82 83 if (rc != 0) { 73 84 printf(NAME ": Failed to create callback from device\n"); 85 async_hangup(dev_sess); 74 86 return false; 75 87 } … … 88 100 void mouse_port_write(uint8_t data) 89 101 { 90 async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data); 102 async_exch_t *exch = async_exchange_begin(dev_sess); 103 if (exch == NULL) { 104 printf("%s: Failed starting exchange with PS/2\n", NAME); 105 return; 106 } 107 108 async_msg_1(exch, CHAR_WRITE_BYTE, data); 109 110 async_exchange_end(exch); 91 111 } 92 112 -
uspace/srv/hid/console/console.c
r5203e256 ra40dea3 54 54 #include <event.h> 55 55 #include <devmap.h> 56 #include <devmap_obsolete.h>57 56 #include <fcntl.h> 58 57 #include <vfs/vfs.h> … … 68 67 #define NAMESPACE "term" 69 68 70 /** Phone tothe input server. */71 static int input_phone;69 /** Session with the input server. */ 70 static async_sess_t *input_sess; 72 71 73 72 /** Information about framebuffer */ … … 109 108 static FIBRIL_CONDVAR_INITIALIZE(input_cv); 110 109 110 static FIBRIL_MUTEX_INITIALIZE(big_console_lock); 111 112 static void console_serialize_start(void) 113 { 114 fibril_mutex_lock(&big_console_lock); 115 } 116 117 static void console_serialize_end(void) 118 { 119 fibril_mutex_unlock(&big_console_lock); 120 } 121 111 122 static void curs_visibility(bool visible) 112 123 { … … 141 152 static void input_yield(void) 142 153 { 143 async_obsolete_req_0_0(input_phone, INPUT_YIELD); 154 async_exch_t *exch = async_exchange_begin(input_sess); 155 if (exch == NULL) { 156 printf("%s: Failed starting exchange with input device.\n", 157 NAME); 158 return; 159 } 160 161 async_req_0_0(exch, INPUT_YIELD); 162 async_exchange_end(exch); 144 163 } 145 164 146 165 static void input_reclaim(void) 147 166 { 148 async_obsolete_req_0_0(input_phone, INPUT_RECLAIM); 167 async_exch_t *exch = async_exchange_begin(input_sess); 168 if (exch == NULL) { 169 printf("%s: Failed starting exchange with input device.\n", 170 NAME); 171 return; 172 } 173 174 async_req_0_0(exch, INPUT_RECLAIM); 175 async_exchange_end(exch); 149 176 } 150 177 … … 323 350 324 351 if (cons == kernel_console) { 325 async_obsolete_serialize_start();352 console_serialize_start(); 326 353 curs_hide_sync(); 327 354 gcons_in_kernel(); 328 355 screen_yield(); 329 356 input_yield(); 330 async_obsolete_serialize_end();357 console_serialize_end(); 331 358 332 359 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) { … … 338 365 339 366 if (cons != kernel_console) { 340 async_obsolete_serialize_start();367 console_serialize_start(); 341 368 342 369 if (active_console == kernel_console) { … … 393 420 curs_visibility(cons->scr.is_cursor_visible); 394 421 395 async_obsolete_serialize_end();422 console_serialize_end(); 396 423 } 397 424 } … … 410 437 if (!IPC_GET_IMETHOD(call)) { 411 438 /* TODO: Handle hangup */ 412 async_ obsolete_hangup(input_phone);439 async_hangup(input_sess); 413 440 return; 414 441 } … … 470 497 } 471 498 472 async_obsolete_serialize_start();499 console_serialize_start(); 473 500 474 501 size_t off = 0; … … 478 505 } 479 506 480 async_obsolete_serialize_end();507 console_serialize_end(); 481 508 482 509 gcons_notify_char(cons->index); … … 573 600 int rc; 574 601 575 async_obsolete_serialize_start();602 console_serialize_start(); 576 603 if (cons->refcount == 0) 577 604 gcons_notify_connect(cons->index); … … 583 610 584 611 while (true) { 585 async_obsolete_serialize_end();612 console_serialize_end(); 586 613 callid = async_get_call(&call); 587 async_obsolete_serialize_start();614 console_serialize_start(); 588 615 589 616 arg1 = 0; … … 595 622 if (cons->refcount == 0) 596 623 gcons_notify_disconnect(cons->index); 624 console_serialize_end(); 597 625 return; 598 626 } … … 600 628 switch (IPC_GET_IMETHOD(call)) { 601 629 case VFS_OUT_READ: 602 async_obsolete_serialize_end();630 console_serialize_end(); 603 631 cons_read(cons, callid, &call); 604 async_obsolete_serialize_start();632 console_serialize_start(); 605 633 continue; 606 634 case VFS_OUT_WRITE: 607 async_obsolete_serialize_end();635 console_serialize_end(); 608 636 cons_write(cons, callid, &call); 609 async_obsolete_serialize_start();637 console_serialize_start(); 610 638 continue; 611 639 case VFS_OUT_SYNC: … … 678 706 break; 679 707 case CONSOLE_GET_EVENT: 680 async_obsolete_serialize_end();708 console_serialize_end(); 681 709 cons_get_event(cons, callid, &call); 682 async_obsolete_serialize_start();710 console_serialize_start(); 683 711 continue; 684 712 case CONSOLE_KCON_ENABLE: … … 695 723 } 696 724 697 static int connect_input(const char *dev_path) 698 { 699 int phone; 725 static async_sess_t *connect_input(const char *dev_path) 726 { 727 async_sess_t *sess; 728 async_exch_t *exch; 700 729 devmap_handle_t handle; 701 730 702 731 int rc = devmap_device_get_handle(dev_path, &handle, 0); 703 732 if (rc == EOK) { 704 phone = devmap_obsolete_device_connect(handle, 0);705 if ( phone < 0) {706 printf("%s: Failed to connect to input device\n", NAME);707 return phone;733 sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0); 734 if (sess == NULL) { 735 printf("%s: Failed to connect to input server\n", NAME); 736 return NULL; 708 737 } 709 738 } else { 710 return rc; 739 return NULL; 740 } 741 742 exch = async_exchange_begin(sess); 743 if (exch == NULL) { 744 printf("%s: Failed to create callback from input server.\n", NAME); 745 return NULL; 711 746 } 712 747 713 748 /* NB: The callback connection is slotted for removal */ 714 rc = async_obsolete_connect_to_me(phone, SERVICE_CONSOLE, 0, 0, 715 input_events, NULL); 749 rc = async_connect_to_me(exch, SERVICE_CONSOLE, 0, 0, input_events, 750 NULL); 751 752 async_exchange_end(exch); 716 753 717 754 if (rc != EOK) { 718 async_ obsolete_hangup(phone);719 printf("%s: Failed to create callback from input device(%s).\n",755 async_hangup(sess); 756 printf("%s: Failed to create callback from input server (%s).\n", 720 757 NAME, str_error(rc)); 721 return rc;722 } 723 724 return phone;758 return NULL; 759 } 760 761 return sess; 725 762 } 726 763 … … 728 765 { 729 766 /* Connect to input server */ 730 input_ phone= connect_input(input_dev);731 if (input_ phone < 0)767 input_sess = connect_input(input_dev); 768 if (input_sess == NULL) 732 769 return false; 733 770 … … 800 837 801 838 /* Initialize the screen */ 802 async_obsolete_serialize_start();839 console_serialize_start(); 803 840 gcons_redraw_console(); 804 841 set_style(STYLE_NORMAL); … … 806 843 curs_goto(0, 0); 807 844 curs_visibility(active_console->scr.is_cursor_visible); 808 async_obsolete_serialize_end();845 console_serialize_end(); 809 846 810 847 /* Receive kernel notifications */ -
uspace/srv/hid/input/port/adb.c
r5203e256 ra40dea3 37 37 #include <ipc/adb.h> 38 38 #include <async.h> 39 #include <async_obsolete.h>40 39 #include <input.h> 41 40 #include <kbd_port.h> … … 45 44 #include <errno.h> 46 45 #include <devmap.h> 47 #include <devmap_obsolete.h>48 46 49 47 static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall, void *arg); … … 63 61 64 62 static kbd_dev_t *kbd_dev; 65 static int dev_phone;63 static async_sess_t *dev_sess; 66 64 67 65 static int adb_port_init(kbd_dev_t *kdev) … … 69 67 const char *dev = "adb/kbd"; 70 68 devmap_handle_t handle; 71 69 async_exch_t *exch; 70 int rc; 71 72 72 kbd_dev = kdev; 73 73 74 int rc = devmap_device_get_handle(dev, &handle, 0); 75 if (rc == EOK) { 76 dev_phone = devmap_obsolete_device_connect(handle, 0); 77 if (dev_phone < 0) { 78 printf("%s: Failed to connect to device\n", NAME); 79 return dev_phone; 80 } 81 } else 74 rc = devmap_device_get_handle(dev, &handle, 0); 75 if (rc != EOK) 82 76 return rc; 83 77 78 dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0); 79 if (dev_sess == NULL) { 80 printf("%s: Failed to connect to device\n", NAME); 81 return ENOENT; 82 } 83 84 exch = async_exchange_begin(dev_sess); 85 if (exch == NULL) { 86 printf("%s: Failed starting exchange with device\n", NAME); 87 async_hangup(dev_sess); 88 return ENOMEM; 89 } 90 84 91 /* NB: The callback connection is slotted for removal */ 85 rc = async_ obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,86 NULL);92 rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL); 93 async_exchange_end(exch); 87 94 if (rc != EOK) { 88 95 printf(NAME ": Failed to create callback from device\n"); 96 async_hangup(dev_sess); 89 97 return rc; 90 98 } -
uspace/srv/hid/input/port/chardev.c
r5203e256 ra40dea3 37 37 #include <ipc/char.h> 38 38 #include <async.h> 39 #include <async_obsolete.h>40 39 #include <input.h> 41 40 #include <kbd_port.h> 42 41 #include <kbd.h> 43 42 #include <devmap.h> 44 #include <devmap_obsolete.h>45 43 #include <errno.h> 46 44 #include <stdio.h> … … 61 59 62 60 static kbd_dev_t *kbd_dev; 63 static int dev_phone;61 static async_sess_t *dev_sess; 64 62 65 63 /** List of devices to try connecting to. */ … … 74 72 { 75 73 devmap_handle_t handle; 74 async_exch_t *exch; 76 75 unsigned int i; 77 76 int rc; … … 90 89 } 91 90 92 dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING); 93 if (dev_phone < 0) { 91 dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 92 IPC_FLAG_BLOCKING); 93 if (dev_sess == NULL) { 94 94 printf("%s: Failed connecting to device\n", NAME); 95 95 return ENOENT; 96 96 } 97 97 98 exch = async_exchange_begin(dev_sess); 99 if (exch == NULL) { 100 printf("%s: Failed starting exchange with device\n", NAME); 101 async_hangup(dev_sess); 102 return ENOMEM; 103 } 104 98 105 /* NB: The callback connection is slotted for removal */ 99 if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events, 100 NULL) != 0) { 106 rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL); 107 async_exchange_end(exch); 108 109 if (rc != 0) { 101 110 printf(NAME ": Failed to create callback from device\n"); 111 async_hangup(dev_sess); 102 112 return -1; 103 113 } 104 114 105 115 return 0; 106 116 } … … 116 126 static void chardev_port_write(uint8_t data) 117 127 { 118 async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data); 128 async_exch_t *exch = async_exchange_begin(dev_sess); 129 if (exch == NULL) { 130 printf("%s: Failed starting exchange with device\n", NAME); 131 return; 132 } 133 134 async_msg_1(exch, CHAR_WRITE_BYTE, data); 135 async_exchange_end(exch); 119 136 } 120 137
Note:
See TracChangeset
for help on using the changeset viewer.