Changeset 25a76ab8 in mainline for uspace/srv/hid/fb/serial_console.c
- Timestamp:
- 2010-05-08T07:53:23Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 051bc69a
- Parents:
- 6c39a907 (diff), 1317380 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/fb/serial_console.c
r6c39a907 r25a76ab8 84 84 SGR_RESET = 0, 85 85 SGR_BOLD = 1, 86 SGR_UNDERLINE = 4, 86 87 SGR_BLINK = 5, 87 88 SGR_REVERSE = 7, 88 SGR_NORMAL_INT = 22,89 SGR_BLINK_OFF = 25,90 SGR_REVERSE_OFF = 27,91 89 SGR_FGCOLOR = 30, 92 90 SGR_BGCOLOR = 40 … … 153 151 switch (style) { 154 152 case STYLE_EMPHASIS: 153 serial_sgr(SGR_RESET); 155 154 if (color) { 156 serial_sgr(SGR_RESET);157 155 serial_sgr(SGR_FGCOLOR + CI_RED); 158 156 serial_sgr(SGR_BGCOLOR + CI_WHITE); … … 161 159 break; 162 160 case STYLE_INVERTED: 161 serial_sgr(SGR_RESET); 163 162 if (color) { 164 serial_sgr(SGR_RESET);165 163 serial_sgr(SGR_FGCOLOR + CI_WHITE); 166 164 serial_sgr(SGR_BGCOLOR + CI_BLACK); 167 serial_sgr(SGR_NORMAL_INT);168 165 } else 169 166 serial_sgr(SGR_REVERSE); 170 167 break; 171 168 case STYLE_SELECTED: 169 serial_sgr(SGR_RESET); 172 170 if (color) { 173 serial_sgr(SGR_RESET);174 171 serial_sgr(SGR_FGCOLOR + CI_WHITE); 175 172 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 } 173 } else 174 serial_sgr(SGR_UNDERLINE); 181 175 break; 182 176 default: 177 serial_sgr(SGR_RESET); 183 178 if (color) { 184 serial_sgr(SGR_RESET);185 179 serial_sgr(SGR_FGCOLOR + CI_BLACK); 186 180 serial_sgr(SGR_BGCOLOR + CI_WHITE); 187 181 } 188 serial_sgr(SGR_NORMAL_INT);189 182 } 190 183 } … … 193 186 uint8_t flags) 194 187 { 188 serial_sgr(SGR_RESET); 195 189 if (color) { 196 serial_sgr(SGR_RESET); 197 serial_sgr(SGR_FGCOLOR + color_map[fgcolor]); 198 serial_sgr(SGR_BGCOLOR + color_map[bgcolor]); 190 serial_sgr(SGR_FGCOLOR + color_map[fgcolor & 7]); 191 serial_sgr(SGR_BGCOLOR + color_map[bgcolor & 7]); 192 if (flags & CATTR_BRIGHT) 193 serial_sgr(SGR_BOLD); 199 194 } else { 200 if (fgcolor < bgcolor) 201 serial_sgr(SGR_RESET); 202 else 195 if (fgcolor >= bgcolor) 203 196 serial_sgr(SGR_REVERSE); 204 } 197 } 205 198 } 206 199 … … 209 202 serial_sgr(SGR_RESET); 210 203 211 if (fgcolor < bgcolor) 212 serial_sgr(SGR_REVERSE_OFF); 213 else 204 if (fgcolor >= bgcolor) 214 205 serial_sgr(SGR_REVERSE); 215 206 } … … 283 274 } 284 275 285 286 287 276 /** Draw text data to viewport. 288 277 * 289 * @param vport Viewport id290 * @param data Text data.291 * @param x Leftmost column of the area.292 * @param y Topmost row of the area.293 * @param w 294 * @param h 278 * @param vport Viewport id 279 * @param data Text data. 280 * @param x0 Leftmost column of the area. 281 * @param y0 Topmost row of the area. 282 * @param width Number of rows. 283 * @param height Number of columns. 295 284 * 296 285 */ 297 static void draw_text_data(keyfield_t *data, ipcarg_t x, ipcarg_t y, 298 ipcarg_t w, ipcarg_t h) 299 { 300 serial_goto(x, y); 301 ipcarg_t i; 302 ipcarg_t j; 303 286 static void draw_text_data(keyfield_t *data, ipcarg_t x0, ipcarg_t y0, 287 ipcarg_t width, ipcarg_t height) 288 { 304 289 attrs_t *a0 = &data[0].attrs; 305 306 for (j = 0; j < h; j++) { 307 if ((j > 0) && (w != scr_width)) 308 serial_goto(x, j); 290 serial_set_attrs(a0); 291 292 ipcarg_t y; 293 for (y = 0; y < height; y++) { 294 serial_goto(x0, y0 + y); 309 295 310 for (i = 0; i < w; i++) { 311 attrs_t *a1 = &data[j * w + i].attrs; 312 313 if (!attrs_same(*a0, *a1)) { 314 serial_set_attrs(a1); 315 a0 = a1; 296 ipcarg_t x; 297 for (x = 0; x < width; x++) { 298 attrs_t *attr = &data[y * width + x].attrs; 299 300 if (!attrs_same(*a0, *attr)) { 301 serial_set_attrs(attr); 302 a0 = attr; 316 303 } 317 304 318 serial_putchar(data[ j * w + i].character);305 serial_putchar(data[y * width + x].character); 319 306 } 320 307 } … … 352 339 ipcarg_t w; 353 340 ipcarg_t h; 354 attrs_t attr;355 341 ssize_t rows; 356 342 … … 430 416 break; 431 417 case FB_SET_STYLE: 432 attr.t = at_style;433 attr.a.s.style = IPC_GET_ARG1(call);418 cur_attr.t = at_style; 419 cur_attr.a.s.style = IPC_GET_ARG1(call); 434 420 serial_set_attrs(&cur_attr); 435 421 retval = 0; 436 422 break; 437 423 case FB_SET_COLOR: 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);424 cur_attr.t = at_idx; 425 cur_attr.a.i.fg_color = IPC_GET_ARG1(call); 426 cur_attr.a.i.bg_color = IPC_GET_ARG2(call); 427 cur_attr.a.i.flags = IPC_GET_ARG3(call); 442 428 serial_set_attrs(&cur_attr); 443 429 retval = 0; 444 430 break; 445 431 case FB_SET_RGB_COLOR: 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);432 cur_attr.t = at_rgb; 433 cur_attr.a.r.fg_color = IPC_GET_ARG1(call); 434 cur_attr.a.r.bg_color = IPC_GET_ARG2(call); 449 435 serial_set_attrs(&cur_attr); 450 436 retval = 0;
Note:
See TracChangeset
for help on using the changeset viewer.