Rev 1528 | Rev 1552 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1528 | Rev 1547 | ||
|---|---|---|---|
| Line 28... | Line 28... | ||
| 28 | 28 | ||
| 29 | #include <ipc/fb.h> |
29 | #include <ipc/fb.h> |
| 30 | #include <ipc/ipc.h> |
30 | #include <ipc/ipc.h> |
| 31 | #include <async.h> |
31 | #include <async.h> |
| 32 | #include <stdio.h> |
32 | #include <stdio.h> |
| - | 33 | #include <sys/mman.h> |
|
| - | 34 | #include <string.h> |
|
| 33 | 35 | ||
| 34 | #include "console.h" |
36 | #include "console.h" |
| 35 | #include "gcons.h" |
37 | #include "gcons.h" |
| 36 | 38 | ||
| 37 | #define CONSOLE_TOP 50 |
39 | #define CONSOLE_TOP 65 |
| 38 | #define CONSOLE_MARGIN 10 |
40 | #define CONSOLE_MARGIN 10 |
| 39 | 41 | ||
| - | 42 | #define STATUS_START 120 |
|
| 40 | #define STATUS_SPACE 20 |
43 | #define STATUS_SPACE 5 |
| 41 | #define STATUS_WIDTH 40 |
44 | #define STATUS_WIDTH 40 |
| 42 | #define STATUS_HEIGHT 30 |
45 | #define STATUS_HEIGHT 30 |
| 43 | 46 | ||
| 44 | #define MAIN_COLOR 0x118811 |
47 | #define MAIN_COLOR 0xffffff |
| 45 | 48 | ||
| 46 | static int use_gcons = 0; |
49 | static int use_gcons = 0; |
| 47 | static ipcarg_t xres,yres; |
50 | static ipcarg_t xres,yres; |
| 48 | 51 | ||
| 49 | static int console_vp; |
52 | static int console_vp; |
| Line 143... | Line 146... | ||
| 143 | draw_stat(consnum, CONS_HAS_INPUT); |
146 | draw_stat(consnum, CONS_HAS_INPUT); |
| 144 | 147 | ||
| 145 | vp_switch(console_vp); |
148 | vp_switch(console_vp); |
| 146 | } |
149 | } |
| 147 | 150 | ||
| - | 151 | static void draw_pixmap(char *logo, size_t size, int x, int y) |
|
| - | 152 | { |
|
| - | 153 | char *shm; |
|
| - | 154 | int rc; |
|
| - | 155 | ||
| - | 156 | /* Create area */ |
|
| - | 157 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); |
|
| - | 158 | if (shm == MAP_FAILED) |
|
| - | 159 | return; |
|
| - | 160 | ||
| - | 161 | memcpy(shm, logo, size); |
|
| - | 162 | /* Send area */ |
|
| - | 163 | rc = sync_send_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); |
|
| - | 164 | if (rc) |
|
| - | 165 | goto exit; |
|
| - | 166 | rc = sync_send_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); |
|
| - | 167 | if (rc) |
|
| - | 168 | goto drop; |
|
| - | 169 | /* Draw logo */ |
|
| - | 170 | send_call_2(fbphone, FB_DRAW_PPM, x, y); |
|
| - | 171 | drop: |
|
| - | 172 | /* Drop area */ |
|
| - | 173 | nsend_call(fbphone, FB_DROP_SHM, 0); |
|
| - | 174 | exit: |
|
| - | 175 | /* Remove area */ |
|
| - | 176 | munmap(shm, size); |
|
| - | 177 | } |
|
| - | 178 | ||
| - | 179 | extern char _binary_helenos_ppm_start[0]; |
|
| - | 180 | extern int _binary_helenos_ppm_size; |
|
| - | 181 | extern char _binary_nameic_ppm_start[0]; |
|
| - | 182 | extern int _binary_nameic_ppm_size; |
|
| 148 | void gcons_redraw_console(void) |
183 | void gcons_redraw_console(void) |
| 149 | { |
184 | { |
| 150 | int i; |
185 | int i; |
| - | 186 | size_t hsize = (size_t)&_binary_helenos_ppm_size; |
|
| 151 | 187 | ||
| 152 | if (!use_gcons) |
188 | if (!use_gcons) |
| 153 | return; |
189 | return; |
| 154 | 190 | ||
| 155 | vp_switch(0); |
191 | vp_switch(0); |
| 156 | set_style(MAIN_COLOR, MAIN_COLOR); |
192 | set_style(MAIN_COLOR, MAIN_COLOR); |
| 157 | clear(); |
193 | clear(); |
| - | 194 | draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-64, 0); |
|
| - | 195 | draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 10); |
|
| - | 196 | ||
| 158 | 197 | ||
| 159 | for (i=0;i < CONSOLE_COUNT; i++) |
198 | for (i=0;i < CONSOLE_COUNT; i++) |
| 160 | draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_DISCONNECTED); |
199 | draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_DISCONNECTED); |
| 161 | vp_switch(console_vp); |
200 | vp_switch(console_vp); |
| 162 | } |
201 | } |
| Line 182... | Line 221... | ||
| 182 | if (console_vp < 0) |
221 | if (console_vp < 0) |
| 183 | return; |
222 | return; |
| 184 | 223 | ||
| 185 | /* Create status buttons */ |
224 | /* Create status buttons */ |
| 186 | for (i=0; i < CONSOLE_COUNT; i++) { |
225 | for (i=0; i < CONSOLE_COUNT; i++) { |
| 187 | cstatus_vp[i] = vp_create(CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), |
226 | cstatus_vp[i] = vp_create(STATUS_START+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), |
| 188 | CONSOLE_MARGIN, STATUS_WIDTH, STATUS_HEIGHT); |
227 | CONSOLE_MARGIN, STATUS_WIDTH, STATUS_HEIGHT); |
| 189 | if (cstatus_vp[i] < 0) |
228 | if (cstatus_vp[i] < 0) |
| 190 | return; |
229 | return; |
| 191 | } |
230 | } |
| 192 | 231 | ||