Changeset 369a5f8 in mainline
- Timestamp:
- 2010-04-20T15:01:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9efff92
- Parents:
- 9f1362d4
- Location:
- uspace
- Files:
-
- 16 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/screen.c
r9f1362d4 r369a5f8 280 280 screen_newline(); 281 281 } 282 283 while (row < rows) { 284 screen_newline(); 285 row++; 286 } 282 287 } 283 288 … … 313 318 screen_newline(); 314 319 } 320 321 while (row < rows) { 322 screen_newline(); 323 row++; 324 } 315 325 } 316 326 -
uspace/lib/c/Makefile
r9f1362d4 r369a5f8 79 79 generic/io/printf_core.c \ 80 80 generic/io/console.c \ 81 generic/io/screenbuffer.c \ 81 82 generic/malloc.c \ 82 83 generic/sysinfo.c \ -
uspace/lib/c/generic/io/asprintf.c
r9f1362d4 r369a5f8 61 61 int asprintf(char **strp, const char *fmt, ...) 62 62 { 63 struct printf_specps = {63 printf_spec_t ps = { 64 64 asprintf_str_write, 65 65 asprintf_wstr_write, -
uspace/lib/c/generic/io/screenbuffer.c
r9f1362d4 r369a5f8 34 34 35 35 #include <io/style.h> 36 #include <io/screenbuffer.h> 36 37 #include <malloc.h> 37 38 #include <unistd.h> 38 #include "screenbuffer.h"39 39 40 40 /** Store one character to screenbuffer. -
uspace/lib/c/generic/io/vprintf.c
r9f1362d4 r369a5f8 76 76 int vfprintf(FILE *stream, const char *fmt, va_list ap) 77 77 { 78 struct printf_specps = {78 printf_spec_t ps = { 79 79 vprintf_str_write, 80 80 vprintf_wstr_write, -
uspace/lib/c/include/io/color.h
r9f1362d4 r369a5f8 36 36 #define LIBC_IO_COLOR_H_ 37 37 38 enum console_color{38 typedef enum { 39 39 COLOR_BLACK = 0, 40 40 COLOR_BLUE = 1, … … 48 48 CATTR_BRIGHT = 8, 49 49 CATTR_BLINK = 8 50 } ;50 } console_color_t; 51 51 52 52 #endif -
uspace/lib/c/include/io/console.h
r9f1362d4 r369a5f8 44 44 } console_ev_type_t; 45 45 46 enum {46 typedef enum { 47 47 CONSOLE_CCAP_NONE = 0, 48 48 CONSOLE_CCAP_STYLE, 49 49 CONSOLE_CCAP_INDEXED, 50 50 CONSOLE_CCAP_RGB 51 } ;51 } console_caps_t; 52 52 53 53 /** Console event structure. */ -
uspace/lib/c/include/io/keycode.h
r9f1362d4 r369a5f8 51 51 * they really are organized here by position, rather than by label. 52 52 */ 53 enum keycode{53 typedef enum { 54 54 55 55 /* Main block row 1 */ … … 199 199 } keycode_t; 200 200 201 enum keymod{201 typedef enum { 202 202 KM_LSHIFT = 0x001, 203 203 KM_RSHIFT = 0x002, -
uspace/lib/c/include/io/klog.h
r9f1362d4 r369a5f8 33 33 */ 34 34 35 #ifndef LIBC_ STREAM_H_36 #define LIBC_ STREAM_H_35 #ifndef LIBC_IO_KLOG_H_ 36 #define LIBC_IO_KLOG_H_ 37 37 38 38 #include <sys/types.h> 39 39 40 extern size_t klog_write(const void * buf, size_t size);40 extern size_t klog_write(const void *, size_t); 41 41 extern void klog_update(void); 42 42 -
uspace/lib/c/include/io/printf_core.h
r9f1362d4 r369a5f8 40 40 41 41 /** Structure for specifying output methods for different printf clones. */ 42 typedef struct printf_spec{42 typedef struct { 43 43 /* String output function, returns number of printed characters or EOF */ 44 44 int (*str_write)(const char *, size_t, void *); … … 51 51 } printf_spec_t; 52 52 53 int printf_core(const char *fmt, printf_spec_t *ps, va_list ap);53 extern int printf_core(const char *, printf_spec_t *, va_list); 54 54 55 55 #endif -
uspace/lib/c/include/io/screenbuffer.h
r9f1362d4 r369a5f8 33 33 */ 34 34 35 #ifndef SCREENBUFFER_H__36 #define SCREENBUFFER_H__35 #ifndef LIBC_SCREENBUFFER_H__ 36 #define LIBC_SCREENBUFFER_H__ 37 37 38 38 #include <stdint.h> … … 41 41 #include <bool.h> 42 42 43 #define DEFAULT_FOREGROUND 0x000000 /**< default console foreground color */ 44 #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ 43 typedef enum { 44 at_style, 45 at_idx, 46 at_rgb 47 } attr_type_t; 45 48 46 49 typedef struct { … … 59 62 } attr_rgb_t; 60 63 64 typedef union { 65 attr_style_t s; 66 attr_idx_t i; 67 attr_rgb_t r; 68 } attr_val_t; 69 61 70 typedef struct { 62 enum { 63 at_style, 64 at_idx, 65 at_rgb 66 } t; 67 union { 68 attr_style_t s; 69 attr_idx_t i; 70 attr_rgb_t r; 71 } a; 71 attr_type_t t; 72 attr_val_t a; 72 73 } attrs_t; 73 74 … … 121 122 * 122 123 */ 123 static inline intattrs_same(attrs_t a1, attrs_t a2)124 static inline bool attrs_same(attrs_t a1, attrs_t a2) 124 125 { 125 126 if (a1.t != a2.t) 126 return 0;127 return false; 127 128 128 129 switch (a1.t) { … … 138 139 } 139 140 140 return 0;141 return false; 141 142 } 142 143 -
uspace/lib/c/include/io/style.h
r9f1362d4 r369a5f8 36 36 #define LIBC_IO_STYLE_H_ 37 37 38 enum console_style{38 typedef enum { 39 39 STYLE_NORMAL = 0, 40 40 STYLE_EMPHASIS = 1, 41 41 STYLE_INVERTED = 2, 42 42 STYLE_SELECTED = 3 43 } ;43 } console_style_t; 44 44 45 45 #endif -
uspace/srv/hid/console/Makefile
r9f1362d4 r369a5f8 33 33 GENERIC_SOURCES = \ 34 34 console.c \ 35 screenbuffer.c \36 35 keybuffer.c \ 37 36 gcons.c -
uspace/srv/hid/console/console.c
r9f1362d4 r369a5f8 54 54 #include <vfs/vfs.h> 55 55 #include <fibril_synch.h> 56 #include <io/style.h> 57 #include <io/screenbuffer.h> 56 58 57 59 #include "console.h" 58 60 #include "gcons.h" 59 61 #include "keybuffer.h" 60 #include "screenbuffer.h" 62 61 63 62 64 #define NAME "console" … … 827 829 async_serialize_start(); 828 830 gcons_redraw_console(); 829 set_ rgb_color(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);831 set_style(STYLE_NORMAL); 830 832 screen_clear(); 831 833 curs_goto(0, 0); -
uspace/srv/hid/fb/ega.c
r9f1362d4 r369a5f8 52 52 #include <io/style.h> 53 53 #include <io/color.h> 54 #include <io/screenbuffer.h> 54 55 #include <sys/types.h> 55 56 56 57 #include "ega.h" 57 #include "../console/screenbuffer.h"58 58 #include "main.h" 59 59 … … 260 260 size_t intersize = 0; 261 261 keyfield_t *interbuf = NULL; 262 262 263 263 if (client_connected) { 264 264 ipc_answer_0(iid, ELIMIT); -
uspace/srv/hid/fb/fb.c
r9f1362d4 r369a5f8 59 59 #include <stdio.h> 60 60 #include <byteorder.h> 61 #include <io/screenbuffer.h> 61 62 62 63 #include "font-8x16.h" 63 64 #include "fb.h" 64 65 #include "main.h" 65 #include "../console/screenbuffer.h"66 66 #include "ppm.h" 67 67 -
uspace/srv/hid/fb/serial_console.c
r9f1362d4 r369a5f8 31 31 /** 32 32 * @defgroup serial Serial console 33 * @brief 33 * @brief Serial console services (putc, puts, clear screen, cursor goto,...) 34 34 * @{ 35 */ 35 */ 36 36 37 37 /** @file … … 47 47 #include <io/style.h> 48 48 #include <str.h> 49 50 #include "../console/screenbuffer.h" 49 #include <io/screenbuffer.h> 50 51 51 #include "main.h" 52 52 #include "serial_console.h" … … 54 54 #define MAX_CONTROL 20 55 55 56 static void serial_sgr(const unsigned int mode); 57 void serial_putchar(wchar_t ch); 58 59 static unsigned int scr_width; 60 static unsigned int scr_height; 61 static bool color = true; /** True if producing color output. */ 62 static bool utf8 = false; /** True if producing UTF8 output. */ 56 static ipcarg_t scr_width; 57 static ipcarg_t scr_height; 58 static bool color = true; /**< True if producing color output. */ 59 static bool utf8 = false; /**< True if producing UTF8 output. */ 63 60 static putc_function_t putc_function; 61 62 static ipcarg_t lastcol = 0; 63 static ipcarg_t lastrow = 0; 64 static attrs_t cur_attr = { 65 .t = at_style, 66 .a.s.style = STYLE_NORMAL 67 }; 64 68 65 69 /* Allow only 1 connection */ … … 67 71 68 72 enum sgr_color_index { 69 CI_BLACK 70 CI_RED 71 CI_GREEN 72 CI_BROWN 73 CI_BLUE 74 CI_MAGENTA 75 CI_CYAN 76 CI_WHITE = 7,73 CI_BLACK = 0, 74 CI_RED = 1, 75 CI_GREEN = 2, 76 CI_BROWN = 3, 77 CI_BLUE = 4, 78 CI_MAGENTA = 5, 79 CI_CYAN = 6, 80 CI_WHITE = 7 77 81 }; 78 82 79 83 enum sgr_command { 80 SGR_RESET 81 SGR_BOLD 82 SGR_BLINK 83 SGR_REVERSE 84 SGR_NORMAL_INT 85 SGR_BLINK_OFF 84 SGR_RESET = 0, 85 SGR_BOLD = 1, 86 SGR_BLINK = 5, 87 SGR_REVERSE = 7, 88 SGR_NORMAL_INT = 22, 89 SGR_BLINK_OFF = 25, 86 90 SGR_REVERSE_OFF = 27, 87 SGR_FGCOLOR 88 SGR_BGCOLOR 91 SGR_FGCOLOR = 30, 92 SGR_BGCOLOR = 40 89 93 }; 90 94 91 95 static int color_map[] = { 92 [COLOR_BLACK] 93 [COLOR_BLUE] 94 [COLOR_GREEN] 95 [COLOR_CYAN] 96 [COLOR_RED] 96 [COLOR_BLACK] = CI_BLACK, 97 [COLOR_BLUE] = CI_RED, 98 [COLOR_GREEN] = CI_GREEN, 99 [COLOR_CYAN] = CI_CYAN, 100 [COLOR_RED] = CI_RED, 97 101 [COLOR_MAGENTA] = CI_MAGENTA, 98 [COLOR_YELLOW] 99 [COLOR_WHITE] 102 [COLOR_YELLOW] = CI_BROWN, 103 [COLOR_WHITE] = CI_WHITE 100 104 }; 101 105 … … 106 110 } 107 111 108 void serial_putchar(wchar_t ch) 109 { 110 char buf[STR_BOUNDS(1)]; 111 size_t offs; 112 size_t i; 113 112 static void serial_putchar(wchar_t ch) 113 { 114 114 if (utf8 != true) { 115 115 if (ch >= 0 && ch < 128) 116 116 (*putc_function)((uint8_t) ch); 117 else 117 else 118 118 (*putc_function)('?'); 119 119 120 return; 120 121 } 121 122 offs = 0; 122 123 size_t offs = 0; 124 char buf[STR_BOUNDS(1)]; 123 125 if (chr_encode(ch, buf, &offs, STR_BOUNDS(1)) == EOK) { 126 size_t i; 124 127 for (i = 0; i < offs; i++) 125 128 (*putc_function)(buf[i]); 126 } else {129 } else 127 130 (*putc_function)('?'); 128 } 129 130 } 131 132 void serial_goto(const unsigned int col, const unsigned int row) 131 } 132 133 void serial_goto(const ipcarg_t col, const ipcarg_t row) 133 134 { 134 135 if ((col > scr_width) || (row > scr_height)) … … 138 139 snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1); 139 140 serial_puts(control); 141 } 142 143 /** ECMA-48 Set Graphics Rendition. */ 144 static void serial_sgr(const unsigned int mode) 145 { 146 char control[MAX_CONTROL]; 147 snprintf(control, MAX_CONTROL, "\033[%um", mode); 148 serial_puts(control); 149 } 150 151 static void serial_set_style(console_style_t style) 152 { 153 switch (style) { 154 case STYLE_EMPHASIS: 155 if (color) { 156 serial_sgr(SGR_RESET); 157 serial_sgr(SGR_FGCOLOR + CI_RED); 158 serial_sgr(SGR_BGCOLOR + CI_WHITE); 159 } 160 serial_sgr(SGR_BOLD); 161 break; 162 case STYLE_INVERTED: 163 if (color) { 164 serial_sgr(SGR_RESET); 165 serial_sgr(SGR_FGCOLOR + CI_WHITE); 166 serial_sgr(SGR_BGCOLOR + CI_BLACK); 167 serial_sgr(SGR_NORMAL_INT); 168 } else 169 serial_sgr(SGR_REVERSE); 170 break; 171 case STYLE_SELECTED: 172 if (color) { 173 serial_sgr(SGR_RESET); 174 serial_sgr(SGR_FGCOLOR + CI_WHITE); 175 serial_sgr(SGR_BGCOLOR + CI_RED); 176 serial_sgr(SGR_NORMAL_INT); 177 } else { 178 serial_sgr(SGR_BOLD); 179 serial_sgr(SGR_REVERSE); 180 } 181 break; 182 default: 183 if (color) { 184 serial_sgr(SGR_RESET); 185 serial_sgr(SGR_FGCOLOR + CI_BLACK); 186 serial_sgr(SGR_BGCOLOR + CI_WHITE); 187 } 188 serial_sgr(SGR_NORMAL_INT); 189 } 190 } 191 192 static void serial_set_idx(uint8_t fgcolor, uint8_t bgcolor, 193 uint8_t flags) 194 { 195 if (color) { 196 serial_sgr(SGR_RESET); 197 serial_sgr(SGR_FGCOLOR + color_map[fgcolor]); 198 serial_sgr(SGR_BGCOLOR + color_map[bgcolor]); 199 } else { 200 if (fgcolor < bgcolor) 201 serial_sgr(SGR_RESET); 202 else 203 serial_sgr(SGR_REVERSE); 204 } 205 } 206 207 static void serial_set_rgb(uint32_t fgcolor, uint32_t bgcolor) 208 { 209 serial_sgr(SGR_RESET); 210 211 if (fgcolor < bgcolor) 212 serial_sgr(SGR_REVERSE_OFF); 213 else 214 serial_sgr(SGR_REVERSE); 215 } 216 217 static void serial_set_attrs(attrs_t *a) 218 { 219 switch (a->t) { 220 case at_style: 221 serial_set_style(a->a.s.style); 222 break; 223 case at_rgb: 224 serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color); 225 break; 226 case at_idx: 227 serial_set_idx(a->a.i.fg_color, a->a.i.bg_color, 228 a->a.i.flags); 229 break; 230 } 140 231 } 141 232 … … 148 239 serial_sgr(SGR_BGCOLOR + CI_WHITE); 149 240 } 150 241 151 242 serial_puts("\033[2J"); 152 } 153 154 void serial_scroll(int i) 243 244 serial_set_attrs(&cur_attr); 245 } 246 247 void serial_scroll(ssize_t i) 155 248 { 156 249 if (i > 0) { … … 165 258 } 166 259 167 /** ECMA-48 Set Graphics Rendition. */168 static void serial_sgr(const unsigned int mode)169 {170 char control[MAX_CONTROL];171 snprintf(control, MAX_CONTROL, "\033[%um", mode);172 serial_puts(control);173 }174 175 260 /** Set scrolling region. */ 176 void serial_set_scroll_region( unsignedlast_row)261 void serial_set_scroll_region(ipcarg_t last_row) 177 262 { 178 263 char control[MAX_CONTROL]; … … 191 276 } 192 277 193 void serial_console_init(putc_function_t putc_fn, uint32_t w, uint32_t h)278 void serial_console_init(putc_function_t putc_fn, ipcarg_t w, ipcarg_t h) 194 279 { 195 280 scr_width = w; … … 198 283 } 199 284 200 static void serial_set_style(int style) 201 { 202 if (style == STYLE_EMPHASIS) { 203 if (color) { 204 serial_sgr(SGR_RESET); 205 serial_sgr(SGR_FGCOLOR + CI_RED); 206 serial_sgr(SGR_BGCOLOR + CI_WHITE); 207 } 208 serial_sgr(SGR_BOLD); 209 } else { 210 if (color) { 211 serial_sgr(SGR_RESET); 212 serial_sgr(SGR_FGCOLOR + CI_BLACK); 213 serial_sgr(SGR_BGCOLOR + CI_WHITE); 214 } 215 serial_sgr(SGR_NORMAL_INT); 216 } 217 } 218 219 static void serial_set_idx(unsigned fgcolor, unsigned bgcolor, 220 unsigned flags) 221 { 222 if (color) { 223 serial_sgr(SGR_RESET); 224 serial_sgr(SGR_FGCOLOR + color_map[fgcolor]); 225 serial_sgr(SGR_BGCOLOR + color_map[bgcolor]); 226 } else { 227 if (fgcolor < bgcolor) 228 serial_sgr(SGR_RESET); 229 else 230 serial_sgr(SGR_REVERSE); 231 } 232 } 233 234 static void serial_set_rgb(uint32_t fgcolor, uint32_t bgcolor) 235 { 236 if (fgcolor < bgcolor) 237 serial_sgr(SGR_REVERSE_OFF); 238 else 239 serial_sgr(SGR_REVERSE); 240 } 241 242 static void serial_set_attrs(const attrs_t *a) 243 { 244 switch (a->t) { 245 case at_style: 246 serial_set_style(a->a.s.style); 247 break; 248 case at_rgb: 249 serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color); 250 break; 251 case at_idx: 252 serial_set_idx(a->a.i.fg_color, 253 a->a.i.bg_color, a->a.i.flags); 254 break; 255 default: 256 break; 257 } 258 } 285 259 286 260 287 /** Draw text data to viewport. … … 262 289 * @param vport Viewport id 263 290 * @param data Text data. 264 * @param x Leftmost column of the area. 265 * @param y Topmost row of the area. 266 * @param w Number of rows. 267 * @param h Number of columns. 268 */ 269 static void draw_text_data(keyfield_t *data, unsigned int x, 270 unsigned int y, unsigned int w, unsigned int h) 271 { 272 unsigned int i, j; 273 keyfield_t *field; 274 attrs_t *a0, *a1; 275 291 * @param x Leftmost column of the area. 292 * @param y Topmost row of the area. 293 * @param w Number of rows. 294 * @param h Number of columns. 295 * 296 */ 297 static void draw_text_data(keyfield_t *data, ipcarg_t x, ipcarg_t y, 298 ipcarg_t w, ipcarg_t h) 299 { 276 300 serial_goto(x, y); 277 a0 = &data[0].attrs; 278 serial_set_attrs(a0); 279 301 ipcarg_t i; 302 ipcarg_t j; 303 304 attrs_t *a0 = &data[0].attrs; 305 280 306 for (j = 0; j < h; j++) { 281 if ( j > 0 && w != scr_width)307 if ((j > 0) && (w != scr_width)) 282 308 serial_goto(x, j); 283 309 284 310 for (i = 0; i < w; i++) { 285 field = &data[j * w + i]; 286 287 a1 = &field->attrs; 288 if (!attrs_same(*a0, *a1)) 311 attrs_t *a1 = &data[j * w + i].attrs; 312 313 if (!attrs_same(*a0, *a1)) { 289 314 serial_set_attrs(a1); 290 serial_putchar(field->character); 291 a0 = a1; 315 a0 = a1; 316 } 317 318 serial_putchar(data[j * w + i].character); 292 319 } 293 320 } 294 321 } 295 296 unsigned int lastcol = 0;297 unsigned int lastrow = 0;298 322 299 323 /** … … 302 326 void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall) 303 327 { 304 int retval;305 ipc_callid_t callid;306 ipc_call_t call;307 328 keyfield_t *interbuf = NULL; 308 329 size_t intersize = 0; 309 310 wchar_t c;311 unsigned int col;312 unsigned int row;313 unsigned int w;314 unsigned int h;315 int i;316 317 attrs_t cur_attr;318 330 319 331 if (client_connected) { … … 324 336 client_connected = 1; 325 337 ipc_answer_0(iid, EOK); 326 327 cur_attr.t = at_style;328 cur_attr.a.s.style = STYLE_NORMAL;329 338 330 339 /* Clear the terminal, set scrolling region … … 335 344 336 345 while (true) { 337 callid = async_get_call(&call); 346 ipc_call_t call; 347 ipc_callid_t callid = async_get_call(&call); 348 349 wchar_t c; 350 ipcarg_t col; 351 ipcarg_t row; 352 ipcarg_t w; 353 ipcarg_t h; 354 attrs_t attr; 355 ssize_t rows; 356 357 int retval; 358 338 359 switch (IPC_GET_METHOD(call)) { 339 360 case IPC_M_PHONE_HUNGUP: 340 361 client_connected = 0; 341 362 ipc_answer_0(callid, EOK); 363 364 /* Exit thread */ 342 365 return; 343 366 case IPC_M_SHARE_OUT: … … 350 373 continue; 351 374 } 375 352 376 retval = EINVAL; 353 377 break; … … 357 381 w = IPC_GET_ARG3(call); 358 382 h = IPC_GET_ARG4(call); 383 359 384 if (!interbuf) { 360 385 retval = EINVAL; 361 386 break; 362 387 } 388 363 389 if ((col + w > scr_width) || (row + h > scr_height)) { 364 390 retval = EINVAL; 365 391 break; 366 392 } 393 367 394 draw_text_data(interbuf, col, row, w, h); 368 395 lastcol = col + w; … … 374 401 col = IPC_GET_ARG2(call); 375 402 row = IPC_GET_ARG3(call); 403 376 404 if ((lastcol != col) || (lastrow != row)) 377 405 serial_goto(col, row); 406 378 407 lastcol = col + 1; 379 408 lastrow = row; … … 401 430 break; 402 431 case FB_SET_STYLE: 403 cur_attr.t = at_style; 404 cur_attr.a.s.style = IPC_GET_ARG1(call); 405 cur_attr.a.i.bg_color = IPC_GET_ARG2(call); 432 attr.t = at_style; 433 attr.a.s.style = IPC_GET_ARG1(call); 406 434 serial_set_attrs(&cur_attr); 407 408 435 retval = 0; 409 436 break; 410 437 case FB_SET_COLOR: 411 cur_attr.t = at_idx;412 cur_attr.a.i.fg_color = IPC_GET_ARG1(call);413 cur_attr.a.i.bg_color = IPC_GET_ARG2(call);414 cur_attr.a.i.flags = IPC_GET_ARG3(call);438 attr.t = at_idx; 439 attr.a.i.fg_color = IPC_GET_ARG1(call); 440 attr.a.i.bg_color = IPC_GET_ARG2(call); 441 attr.a.i.flags = IPC_GET_ARG3(call); 415 442 serial_set_attrs(&cur_attr); 416 417 443 retval = 0; 418 444 break; 419 445 case FB_SET_RGB_COLOR: 420 cur_attr.t = at_rgb;421 cur_attr.a.i.fg_color = IPC_GET_ARG1(call);422 cur_attr.a.i.bg_color = IPC_GET_ARG2(call);446 attr.t = at_rgb; 447 attr.a.r.fg_color = IPC_GET_ARG1(call); 448 attr.a.r.bg_color = IPC_GET_ARG2(call); 423 449 serial_set_attrs(&cur_attr); 424 425 450 retval = 0; 426 451 break; 427 452 case FB_SCROLL: 428 i = IPC_GET_ARG1(call); 429 if ((i > (int) scr_height) || (i < -((int) scr_height))) { 430 retval = EINVAL; 431 break; 453 rows = IPC_GET_ARG1(call); 454 455 if (rows >= 0) { 456 if ((ipcarg_t) rows > scr_height) { 457 retval = EINVAL; 458 break; 459 } 460 } else { 461 if ((ipcarg_t) (-rows) > scr_height) { 462 retval = EINVAL; 463 break; 464 } 432 465 } 433 serial_scroll(i); 466 467 serial_scroll(rows); 434 468 serial_goto(lastcol, lastrow); 435 469 retval = 0; … … 451 485 case FB_SCREEN_RECLAIM: 452 486 serial_clrscr(); 453 serial_set_attrs(&cur_attr);454 487 retval = 0; 455 488 break; -
uspace/srv/hid/fb/serial_console.h
r9f1362d4 r369a5f8 29 29 /** 30 30 * @defgroup serial Serial console 31 * @brief 31 * @brief Serial console services (putc, puts, clear screen, cursor goto,...) 32 32 * @{ 33 */ 33 */ 34 34 35 35 /** @file … … 43 43 typedef void (*putc_function_t)(char); 44 44 45 void serial_puts(const char *str); 46 void serial_goto(const unsigned int col, const unsigned int row); 47 void serial_clrscr(void); 48 void serial_scroll(int i); 49 void serial_cursor_disable(void); 50 void serial_cursor_enable(void); 51 void serial_set_scroll_region(unsigned height); 52 void serial_console_init(putc_function_t putc_fn, uint32_t w, uint32_t h); 53 void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall); 54 45 extern void serial_puts(const char *); 46 extern void serial_goto(const ipcarg_t, const ipcarg_t); 47 extern void serial_clrscr(void); 48 extern void serial_scroll(ssize_t); 49 extern void serial_cursor_disable(void); 50 extern void serial_cursor_enable(void); 51 extern void serial_set_scroll_region(ipcarg_t); 52 extern void serial_console_init(putc_function_t, ipcarg_t, ipcarg_t); 53 extern void serial_client_connection(ipc_callid_t, ipc_call_t *); 55 54 56 55 #endif
Note:
See TracChangeset
for help on using the changeset viewer.