| 1 | interface console extends service {
|
|---|
| 2 | /* Read characters from console */
|
|---|
| 3 | ipcarg_t read(out_copy stream data);
|
|---|
| 4 |
|
|---|
| 5 | /* Write characters to console */
|
|---|
| 6 | ipcarg_t write(in_copy stream data);
|
|---|
| 7 |
|
|---|
| 8 | /* Get last event from event queue */
|
|---|
| 9 | ipcarg_t get_event(out ipcarg_t type, out ipcarg_t key, out ipcarg_t mods, out ipcarg_t char);
|
|---|
| 10 |
|
|---|
| 11 | /* Flush output buffer */
|
|---|
| 12 | ipcarg_t sync(void);
|
|---|
| 13 |
|
|---|
| 14 | /* Clear console */
|
|---|
| 15 | ipcarg_t clear(void);
|
|---|
| 16 |
|
|---|
| 17 | /* Move cursor to given position */
|
|---|
| 18 | ipcarg_t goto(in ipcarg_t col, in ipcarg_t row);
|
|---|
| 19 |
|
|---|
| 20 | /* Get console dimensions (in character cells) */
|
|---|
| 21 | ipcarg_t get_size(out ipcarg_t cols, in ipcarg_t rows);
|
|---|
| 22 |
|
|---|
| 23 | /* Get color capabilities */
|
|---|
| 24 | ipcarg_t get_color_cap(void);
|
|---|
| 25 |
|
|---|
| 26 | /* Set abstract text style */
|
|---|
| 27 | ipcarg_t set_style(in ipcarg_t style);
|
|---|
| 28 |
|
|---|
| 29 | /* Set EGA-based text color */
|
|---|
| 30 | ipcarg_t set_color(in ipcarg_t fb_color, in ipcarg_t bg_color, in ipcarg_t attr);
|
|---|
| 31 |
|
|---|
| 32 | /* Set RGB-based text color */
|
|---|
| 33 | ipcarg_t set_rgb_color(in ipcarg_t fb_color, in ipcarg_t bg_color);
|
|---|
| 34 |
|
|---|
| 35 | /* Set cursor visibility */
|
|---|
| 36 | ipcarg_t cursor_visibility(in ipcarg_t visible);
|
|---|
| 37 |
|
|---|
| 38 | /* Switch to kernel debugging console (if available) */
|
|---|
| 39 | ipcarg_t kcon_enable(void);
|
|---|
| 40 | protocol:
|
|---|
| 41 | [console.bp]
|
|---|
| 42 | };
|
|---|
| 43 |
|
|---|
| 44 | frame ui_dispatcher {
|
|---|
| 45 | provides:
|
|---|
| 46 | console console;
|
|---|
| 47 | event event;
|
|---|
| 48 | requires:
|
|---|
| 49 | [/uspace/lib/libc/requires]
|
|---|
| 50 | ns ns;
|
|---|
| 51 | devmap_driver devmap_driver;
|
|---|
| 52 | sys_console sys_console;
|
|---|
| 53 | kbd kbd;
|
|---|
| 54 | fb fb;
|
|---|
| 55 | initialization:
|
|---|
| 56 | !ns.ipc_m_connect_me_to /* kbd */ ;
|
|---|
| 57 | !kbd.ipc_m_connect_to_me ;
|
|---|
| 58 | !ns.ipc_m_connect_me_to /* fb */ ;
|
|---|
| 59 | [/uspace/lib/libc/fnc.devmap_driver_register] ;
|
|---|
| 60 | !fb.get_resolution ;
|
|---|
| 61 | (
|
|---|
| 62 | [fnc.vp_create] +
|
|---|
| 63 | [fnc.vp_switch]
|
|---|
| 64 | )* ;
|
|---|
| 65 | [fnc.make_pixmap]* ;
|
|---|
| 66 | [fnc.make_anim] ;
|
|---|
| 67 | [fnc.vp_switch] ;
|
|---|
| 68 | !fb.flush ;
|
|---|
| 69 | !fb.get_csize ;
|
|---|
| 70 | !fb.get_color_cap ;
|
|---|
| 71 | !fb.ipc_m_share_out ;
|
|---|
| 72 | [/uspace/lib/libc/fnc.devmap_device_register]* ;
|
|---|
| 73 | !sys_console.sys_debug_disable_console ;
|
|---|
| 74 | [fnc.gcons_redraw_console] ;
|
|---|
| 75 | [fnc.set_rgb_color] ;
|
|---|
| 76 | [fnc.screen_clear] ;
|
|---|
| 77 | [fnc.curs_goto] ;
|
|---|
| 78 | [fnc.curs_visibility]
|
|---|
| 79 | protocol:
|
|---|
| 80 | [/uspace/lib/libc/protocol]
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | architecture console {
|
|---|
| 84 | inst ui_dispatcher ui_dispatcher;
|
|---|
| 85 | inst kbd kbd;
|
|---|
| 86 | inst fb fb;
|
|---|
| 87 |
|
|---|
| 88 | bind ui_dispatcher:kbd to kbd:kbd;
|
|---|
| 89 | bind ui_dispatcher:fb to fb:fb;
|
|---|
| 90 |
|
|---|
| 91 | bind kbd:event to ui_dispatcher:event;
|
|---|
| 92 |
|
|---|
| 93 | delegate console to ui_dispatcher:console;
|
|---|
| 94 | delegate kbd to kbd:kbd;
|
|---|
| 95 | delegate fb to fb:fb;
|
|---|
| 96 |
|
|---|
| 97 | [/uspace/lib/libc/subsume%ui_dispatcher]
|
|---|
| 98 | [/uspace/lib/libc/subsume%kbd]
|
|---|
| 99 | [/uspace/lib/libc/subsume%fb]
|
|---|
| 100 |
|
|---|
| 101 | subsume ui_dispatcher:ns to ns;
|
|---|
| 102 | subsume ui_dispatcher:devmap_driver to devmap_driver;
|
|---|
| 103 | subsume ui_dispatcher:sys_console to sys_console;
|
|---|
| 104 |
|
|---|
| 105 | subsume kbd:ns to ns;
|
|---|
| 106 | subsume fb:ns to ns;
|
|---|
| 107 | };
|
|---|