Changeset e1c4849 in mainline
- Timestamp:
- 2006-06-02T17:16:59Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0c6984e
- Parents:
- 3756912
- Location:
- console
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
console/Makefile
r3756912 re1c4849 45 45 console.c \ 46 46 screenbuffer.c \ 47 ../kbd/generic/key_buffer.c 47 ../kbd/generic/key_buffer.c \ 48 gcons.c 48 49 49 50 ARCH_SOURCES = -
console/console.c
r3756912 re1c4849 42 42 #include <sys/mman.h> 43 43 44 #include "gcons.h" 45 44 46 #define MAX_KEYREQUESTS_BUFFERED 32 45 47 … … 178 180 // if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) { 179 181 if ((c >= '0') && (c < '0' + CONSOLE_COUNT)) { 180 181 182 if (c == '0') { 182 183 /* switch to kernel console*/ … … 193 194 break; 194 195 active_console = c; 196 gcons_change_console(c); 197 195 198 } 196 199 … … 337 340 usleep(10000); 338 341 } 342 343 /* Initialize gcons */ 344 gcons_init(fb_info.phone); 345 /* Synchronize, the gcons can have something in queue */ 346 sync_send_2(fb_info.phone, FB_GET_CSIZE, 0, 0, NULL, NULL); 347 339 348 340 349 ipc_call_sync_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols)); … … 368 377 async_new_connection(phonehash, 0, NULL, keyboard_events); 369 378 370 nsend_call_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0);379 sync_send_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0, NULL, NULL); 371 380 nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 1); 372 381 -
console/gcons.c
r3756912 re1c4849 29 29 #include <ipc/fb.h> 30 30 #include <ipc/ipc.h> 31 #include <async.h> 32 #include <stdio.h> 31 33 32 34 #include "console.h" 35 #include "gcons.h" 33 36 34 37 #define CONSOLE_TOP 50 … … 39 42 #define STATUS_HEIGHT 30 40 43 44 #define MAIN_COLOR 0x118811 45 41 46 static int use_gcons = 0; 42 47 static ipcarg_t xres,yres; … … 44 49 static int console_vp; 45 50 static int cstatus_vp[CONSOLE_COUNT]; 51 static int cstat_row, cstat_col; /* Size of cstatus buttons */ 46 52 47 53 static int fbphone; 48 54 55 enum butstate { 56 CONS_ACTIVE = 0, 57 CONS_IDLE, 58 CONS_HAS_INPUT 59 }; 60 61 static struct { 62 int fgcolor; 63 int bgcolor; 64 } stat_colors[] = { 65 {0xd0d0d0, 0x808080}, 66 {0xd0d0d0, 0x0}, 67 {0xd0d0d0, 0xa04040} 68 }; 69 70 static int active_console = 0; 71 49 72 static void vp_switch(int vp) 50 73 { 51 ipc_call_sync_2(fbphone,FB_VIEWPORT_SWITCH, vp, 0, NULL, NULL);74 nsend_call(fbphone,FB_VIEWPORT_SWITCH, vp); 52 75 } 53 76 77 /** Create view port */ 54 78 static int vp_create(unsigned int x, unsigned int y, 55 unsigned int width, uns gined int height)79 unsigned int width, unsigned int height) 56 80 { 57 return ipc_call_sync_2(fbphone, (x << 16) | y, (width << 16) | height, 58 NULL, NULL); 81 /* Init function, use ipc_call_sync */ 82 return ipc_call_sync_2(fbphone, FB_VIEWPORT_CREATE, 83 (x << 16) | y, (width << 16) | height, 84 NULL, NULL); 59 85 } 60 86 61 static void fb_clear(void)87 static void clear(void) 62 88 { 63 ipc_call_sync_2(fbphone, FB_CLEAR, 0, 0, NULL, NULL);89 nsend_call(fbphone, FB_CLEAR, 0); 64 90 65 91 } 66 92 67 static void fb_set_style(int fgcolor, int bgcolor)93 static void set_style(int fgcolor, int bgcolor) 68 94 { 69 ipc_call_sync_2(fbphone, ); 95 nsend_call_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor); 96 } 97 98 static void putch(char c, int row, int col) 99 { 100 nsend_call_3(fbphone, FB_PUTCHAR, c, row, col); 101 } 102 103 static void draw_stat(int consnum, enum butstate state) 104 { 105 char data[5]; 106 int i; 107 108 vp_switch(cstatus_vp[consnum]); 109 set_style(stat_colors[state].fgcolor, stat_colors[state].bgcolor); 110 clear(); 111 snprintf(data, 5, "%d", consnum+1); 112 for (i=0;data[i];i++) 113 putch(data[i], 0, i); 70 114 } 71 115 … … 74 118 if (!use_gcons) 75 119 return; 76 120 121 draw_stat(active_console, CONS_IDLE); 122 active_console = consnum; 123 draw_stat(consnum, CONS_ACTIVE); 77 124 vp_switch(console_vp); 78 125 } … … 86 133 } 87 134 88 void gcons_redraw_console( int phone)135 void gcons_redraw_console(void) 89 136 { 137 int i; 138 90 139 if (!use_gcons) 91 140 return; 92 141 93 142 vp_switch(0); 94 /* Set style...*/ 95 fb_clear(); 96 143 set_style(MAIN_COLOR, MAIN_COLOR); 144 clear(); 145 146 for (i=0;i < CONSOLE_COUNT; i++) 147 draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_IDLE); 97 148 vp_switch(console_vp); 98 149 } … … 121 172 /* Create status buttons */ 122 173 for (i=0; i < CONSOLE_COUNT; i++) { 123 cstatus_vp[i] = vp_create( phone,CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE),174 cstatus_vp[i] = vp_create(CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), 124 175 CONSOLE_MARGIN, STATUS_WIDTH, STATUS_HEIGHT); 125 176 if (cstatus_vp[i] < 0) … … 128 179 129 180 use_gcons = 1; 130 gcons_ draw_console();181 gcons_redraw_console(); 131 182 }
Note:
See TracChangeset
for help on using the changeset viewer.