Rev 4494 | Rev 4509 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4494 | Rev 4497 | ||
---|---|---|---|
Line 709... | Line 709... | ||
709 | change_console(prev_console); |
709 | change_console(prev_console); |
710 | } |
710 | } |
711 | 711 | ||
712 | static bool console_init(void) |
712 | static bool console_init(void) |
713 | { |
713 | { |
714 | /* Connect to keyboard driver */ |
714 | async_serialize_start(); |
715 | 715 | ||
- | 716 | /* Connect to keyboard driver */ |
|
716 | kbd_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_KEYBOARD, 0, 0); |
717 | kbd_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_KEYBOARD, 0, 0); |
717 | if (kbd_phone < 0) { |
718 | if (kbd_phone < 0) { |
718 | printf(NAME ": Failed to connect to keyboard service\n"); |
719 | printf(NAME ": Failed to connect to keyboard service\n"); |
- | 720 | async_serialize_end(); |
|
719 | return false; |
721 | return false; |
720 | } |
722 | } |
721 | 723 | ||
722 | ipcarg_t phonehash; |
724 | ipcarg_t phonehash; |
723 | if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) { |
725 | if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) { |
724 | printf(NAME ": Failed to create callback from keyboard service\n"); |
726 | printf(NAME ": Failed to create callback from keyboard service\n"); |
- | 727 | async_serialize_end(); |
|
725 | return false; |
728 | return false; |
726 | } |
729 | } |
727 | 730 | ||
728 | async_set_pending(process_pending_input); |
731 | async_set_pending(process_pending_input); |
729 | async_new_connection(phonehash, 0, NULL, keyboard_events); |
732 | async_new_connection(phonehash, 0, NULL, keyboard_events); |
730 | 733 | ||
731 | /* Connect to framebuffer driver */ |
734 | /* Connect to framebuffer driver */ |
732 | fb_info.phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VIDEO, 0, 0); |
735 | fb_info.phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VIDEO, 0, 0); |
733 | if (fb_info.phone < 0) { |
736 | if (fb_info.phone < 0) { |
734 | printf(NAME ": Failed to connect to video service\n"); |
737 | printf(NAME ": Failed to connect to video service\n"); |
- | 738 | async_serialize_end(); |
|
735 | return -1; |
739 | return -1; |
736 | } |
740 | } |
737 | 741 | ||
738 | /* Register driver */ |
742 | /* Register driver */ |
739 | int rc = devmap_driver_register(NAME, client_connection); |
743 | int rc = devmap_driver_register(NAME, client_connection); |
740 | if (rc < 0) { |
744 | if (rc < 0) { |
741 | printf(NAME ": Unable to register driver (%d)\n", rc); |
745 | printf(NAME ": Unable to register driver (%d)\n", rc); |
- | 746 | async_serialize_end(); |
|
742 | return false; |
747 | return false; |
743 | } |
748 | } |
744 | 749 | ||
745 | /* Initialize gcons */ |
750 | /* Initialize gcons */ |
746 | gcons_init(fb_info.phone); |
751 | gcons_init(fb_info.phone); |
Line 772... | Line 777... | ||
772 | for (i = 0; i < CONSOLE_COUNT; i++) { |
777 | for (i = 0; i < CONSOLE_COUNT; i++) { |
773 | if (i != KERNEL_CONSOLE) { |
778 | if (i != KERNEL_CONSOLE) { |
774 | if (screenbuffer_init(&consoles[i].scr, |
779 | if (screenbuffer_init(&consoles[i].scr, |
775 | fb_info.cols, fb_info.rows) == NULL) { |
780 | fb_info.cols, fb_info.rows) == NULL) { |
776 | printf(NAME ": Unable to allocate screen buffer %u\n", i); |
781 | printf(NAME ": Unable to allocate screen buffer %u\n", i); |
- | 782 | async_serialize_end(); |
|
777 | return false; |
783 | return false; |
778 | } |
784 | } |
779 | screenbuffer_clear(&consoles[i].scr); |
785 | screenbuffer_clear(&consoles[i].scr); |
780 | keybuffer_init(&consoles[i].keybuffer); |
786 | keybuffer_init(&consoles[i].keybuffer); |
781 | consoles[i].index = i; |
787 | consoles[i].index = i; |
Line 785... | Line 791... | ||
785 | snprintf(vc, MAX_DEVICE_NAME, "vc%u", i); |
791 | snprintf(vc, MAX_DEVICE_NAME, "vc%u", i); |
786 | 792 | ||
787 | if (devmap_device_register(vc, &consoles[i].dev_handle) != EOK) { |
793 | if (devmap_device_register(vc, &consoles[i].dev_handle) != EOK) { |
788 | devmap_hangup_phone(DEVMAP_DRIVER); |
794 | devmap_hangup_phone(DEVMAP_DRIVER); |
789 | printf(NAME ": Unable to register device %s\n", vc); |
795 | printf(NAME ": Unable to register device %s\n", vc); |
- | 796 | async_serialize_end(); |
|
790 | return false; |
797 | return false; |
791 | } |
798 | } |
792 | } |
799 | } |
793 | } |
800 | } |
794 | 801 | ||
Line 806... | Line 813... | ||
806 | if (event_subscribe(EVENT_KCONSOLE, 0) != EOK) |
813 | if (event_subscribe(EVENT_KCONSOLE, 0) != EOK) |
807 | printf(NAME ": Error registering kconsole notifications\n"); |
814 | printf(NAME ": Error registering kconsole notifications\n"); |
808 | 815 | ||
809 | async_set_interrupt_received(interrupt_received); |
816 | async_set_interrupt_received(interrupt_received); |
810 | 817 | ||
- | 818 | async_serialize_end(); |
|
811 | return true; |
819 | return true; |
812 | } |
820 | } |
813 | 821 | ||
814 | int main(int argc, char *argv[]) |
822 | int main(int argc, char *argv[]) |
815 | { |
823 | { |