Rev 4154 | Rev 4164 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4154 | Rev 4160 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | #include <ipc/services.h> |
40 | #include <ipc/services.h> |
41 | #include <console.h> |
41 | #include <console.h> |
42 | 42 | ||
43 | static int console_phone = -1; |
43 | static int console_phone = -1; |
44 | 44 | ||
45 | void console_open(void) |
45 | void console_open(bool blocking) |
46 | { |
46 | { |
47 | if (console_phone < 0) { |
47 | if (console_phone < 0) { |
- | 48 | int phone; |
|
- | 49 | if (blocking) { |
|
- | 50 | phone = ipc_connect_me_to_blocking(PHONE_NS, |
|
- | 51 | SERVICE_CONSOLE, 0, 0); |
|
- | 52 | } else { |
|
48 | int phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, 0); |
53 | phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, |
- | 54 | 0); |
|
- | 55 | } |
|
49 | if (phone >= 0) |
56 | if (phone >= 0) |
50 | console_phone = phone; |
57 | console_phone = phone; |
51 | } |
58 | } |
52 | } |
59 | } |
53 | 60 | ||
Line 58... | Line 65... | ||
58 | console_phone = -1; |
65 | console_phone = -1; |
59 | } |
66 | } |
60 | } |
67 | } |
61 | } |
68 | } |
62 | 69 | ||
63 | int console_phone_get(void) |
70 | int console_phone_get(bool blocking) |
64 | { |
71 | { |
65 | if (console_phone < 0) |
72 | if (console_phone < 0) |
66 | console_open(); |
73 | console_open(blocking); |
67 | 74 | ||
68 | return console_phone; |
75 | return console_phone; |
69 | } |
76 | } |
70 | 77 | ||
71 | void console_wait(void) |
78 | void console_wait(void) |
72 | { |
79 | { |
73 | while (console_phone < 0) |
80 | while (console_phone < 0) |
74 | console_open(); |
81 | console_open(true); |
75 | } |
82 | } |
76 | 83 | ||
77 | void console_clear(void) |
84 | void console_clear(void) |
78 | { |
85 | { |
79 | int cons_phone = console_phone_get(); |
86 | int cons_phone = console_phone_get(true); |
80 | async_msg_0(cons_phone, CONSOLE_CLEAR); |
87 | async_msg_0(cons_phone, CONSOLE_CLEAR); |
81 | } |
88 | } |
82 | 89 | ||
83 | void console_goto(int row, int col) |
90 | void console_goto(int row, int col) |
84 | { |
91 | { |
85 | int cons_phone = console_phone_get(); |
92 | int cons_phone = console_phone_get(true); |
86 | async_msg_2(cons_phone, CONSOLE_GOTO, row, col); |
93 | async_msg_2(cons_phone, CONSOLE_GOTO, row, col); |
87 | } |
94 | } |
88 | 95 | ||
89 | void console_putchar(int c) |
96 | void console_putchar(int c) |
90 | { |
97 | { |
91 | int cons_phone = console_phone_get(); |
98 | int cons_phone = console_phone_get(true); |
92 | async_msg_1(cons_phone, CONSOLE_PUTCHAR, c); |
99 | async_msg_1(cons_phone, CONSOLE_PUTCHAR, c); |
93 | } |
100 | } |
94 | 101 | ||
95 | void console_flush(void) |
102 | void console_flush(void) |
96 | { |
103 | { |
97 | int cons_phone = console_phone_get(); |
104 | int cons_phone = console_phone_get(true); |
98 | async_msg_0(cons_phone, CONSOLE_FLUSH); |
105 | async_msg_0(cons_phone, CONSOLE_FLUSH); |
99 | } |
106 | } |
100 | 107 | ||
101 | int console_get_size(int *rows, int *cols) |
108 | int console_get_size(int *rows, int *cols) |
102 | { |
109 | { |
103 | int cons_phone = console_phone_get(); |
110 | int cons_phone = console_phone_get(true); |
104 | ipcarg_t r, c; |
111 | ipcarg_t r, c; |
105 | int rc; |
112 | int rc; |
106 | 113 | ||
107 | rc = async_req_0_2(cons_phone, CONSOLE_GETSIZE, &r, &c); |
114 | rc = async_req_0_2(cons_phone, CONSOLE_GETSIZE, &r, &c); |
108 | 115 | ||
Line 112... | Line 119... | ||
112 | return rc; |
119 | return rc; |
113 | } |
120 | } |
114 | 121 | ||
115 | void console_set_style(int style) |
122 | void console_set_style(int style) |
116 | { |
123 | { |
117 | int cons_phone = console_phone_get(); |
124 | int cons_phone = console_phone_get(true); |
118 | async_msg_1(cons_phone, CONSOLE_SET_STYLE, style); |
125 | async_msg_1(cons_phone, CONSOLE_SET_STYLE, style); |
119 | } |
126 | } |
120 | 127 | ||
121 | void console_set_color(int fg_color, int bg_color, int flags) |
128 | void console_set_color(int fg_color, int bg_color, int flags) |
122 | { |
129 | { |
123 | int cons_phone = console_phone_get(); |
130 | int cons_phone = console_phone_get(true); |
124 | async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags); |
131 | async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags); |
125 | } |
132 | } |
126 | 133 | ||
127 | void console_set_rgb_color(int fg_color, int bg_color) |
134 | void console_set_rgb_color(int fg_color, int bg_color) |
128 | { |
135 | { |
129 | int cons_phone = console_phone_get(); |
136 | int cons_phone = console_phone_get(true); |
130 | async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color); |
137 | async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color); |
131 | } |
138 | } |
132 | 139 | ||
133 | void console_cursor_visibility(int show) |
140 | void console_cursor_visibility(int show) |
134 | { |
141 | { |
135 | int cons_phone = console_phone_get(); |
142 | int cons_phone = console_phone_get(true); |
136 | async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0); |
143 | async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0); |
137 | } |
144 | } |
138 | 145 | ||
139 | /** @} |
146 | /** @} |
140 | */ |
147 | */ |