Changeset b366a6f4 in mainline for kernel/genarch/src
- Timestamp:
- 2011-06-24T15:58:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7250d2c
- Parents:
- ee2fa30a
- Location:
- kernel/genarch/src
- Files:
-
- 4 edited
-
drivers/dsrln/dsrlnout.c (modified) (3 diffs)
-
drivers/ega/ega.c (modified) (13 diffs)
-
drivers/s3c24xx_uart/s3c24xx_uart.c (modified) (5 diffs)
-
fb/fb.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/dsrln/dsrlnout.c
ree2fa30a rb366a6f4 42 42 #include <sysinfo/sysinfo.h> 43 43 #include <str.h> 44 #include <ddi/ddi.h> 44 45 45 46 typedef struct { 47 parea_t parea; 46 48 ioport8_t *base; 47 49 } dsrlnout_instance_t; 48 50 49 static void dsrlnout_putchar(outdev_t *dev, const wchar_t ch , bool silent)51 static void dsrlnout_putchar(outdev_t *dev, const wchar_t ch) 50 52 { 51 53 dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data; 52 54 53 if ( !silent) {55 if ((!instance->parea.mapped) || (console_override)) { 54 56 if (ascii_check(ch)) 55 57 pio_write_8(instance->base, ch); … … 70 72 return NULL; 71 73 72 dsrlnout_instance_t *instance = malloc(sizeof(dsrlnout_instance_t), FRAME_ATOMIC); 74 dsrlnout_instance_t *instance = malloc(sizeof(dsrlnout_instance_t), 75 FRAME_ATOMIC); 73 76 if (!instance) { 74 77 free(dsrlndev); … … 80 83 81 84 instance->base = base; 85 link_initialize(&instance->parea.link); 86 instance->parea.pbase = KA2PA(base); 87 instance->parea.frames = 1; 88 instance->parea.unpriv = false; 89 instance->parea.mapped = false; 90 ddi_parea_register(&instance->parea); 82 91 83 92 if (!fb_exported) { 84 93 /* 85 * This is the necessary evil until the userspace driver is entirely 94 * This is the necessary evil until 95 * the userspace driver is entirely 86 96 * self-sufficient. 87 97 */ -
kernel/genarch/src/drivers/ega/ega.c
ree2fa30a rb366a6f4 64 64 IRQ_SPINLOCK_DECLARE(lock); 65 65 66 parea_t parea; 67 66 68 uint32_t cursor; 67 69 uint8_t *addr; … … 70 72 } ega_instance_t; 71 73 72 static void ega_putchar(outdev_t *, wchar_t , bool);74 static void ega_putchar(outdev_t *, wchar_t); 73 75 static void ega_redraw(outdev_t *); 74 76 … … 437 439 * This function takes care of scrolling. 438 440 */ 439 static void ega_check_cursor(ega_instance_t *instance , bool silent)441 static void ega_check_cursor(ega_instance_t *instance) 440 442 { 441 443 if (instance->cursor < EGA_SCREEN) … … 448 450 EGA_COLS, EMPTY_CHAR); 449 451 450 if ( !silent) {452 if ((!instance->parea.mapped) || (console_override)) { 451 453 memmove((void *) instance->addr, 452 454 (void *) (instance->addr + EGA_COLS * 2), … … 459 461 } 460 462 461 static void ega_show_cursor(ega_instance_t *instance , bool silent)462 { 463 if ( !silent) {463 static void ega_show_cursor(ega_instance_t *instance) 464 { 465 if ((!instance->parea.mapped) || (console_override)) { 464 466 pio_write_8(instance->base + EGA_INDEX_REG, 0x0a); 465 467 uint8_t stat = pio_read_8(instance->base + EGA_DATA_REG); … … 469 471 } 470 472 471 static void ega_move_cursor(ega_instance_t *instance , bool silent)472 { 473 if ( !silent) {473 static void ega_move_cursor(ega_instance_t *instance) 474 { 475 if ((!instance->parea.mapped) || (console_override)) { 474 476 pio_write_8(instance->base + EGA_INDEX_REG, 0x0e); 475 477 pio_write_8(instance->base + EGA_DATA_REG, … … 481 483 } 482 484 483 static void ega_sync_cursor(ega_instance_t *instance , bool silent)484 { 485 if ( !silent) {485 static void ega_sync_cursor(ega_instance_t *instance) 486 { 487 if ((!instance->parea.mapped) || (console_override)) { 486 488 pio_write_8(instance->base + EGA_INDEX_REG, 0x0e); 487 489 uint8_t hi = pio_read_8(instance->base + EGA_DATA_REG); … … 503 505 EGA_SCREEN - instance->cursor, EMPTY_CHAR); 504 506 505 if ( !silent)507 if ((!instance->parea.mapped) || (console_override)) 506 508 memsetw(instance->addr + instance->cursor * 2, 507 509 EGA_SCREEN - instance->cursor, EMPTY_CHAR); 508 510 509 ega_check_cursor(instance , silent);510 ega_move_cursor(instance , silent);511 ega_show_cursor(instance , silent);512 } 513 514 static void ega_display_char(ega_instance_t *instance, wchar_t ch , bool silent)511 ega_check_cursor(instance); 512 ega_move_cursor(instance); 513 ega_show_cursor(instance); 514 } 515 516 static void ega_display_char(ega_instance_t *instance, wchar_t ch) 515 517 { 516 518 uint16_t index = ega_oem_glyph(ch); … … 529 531 instance->backbuf[instance->cursor * 2 + 1] = style; 530 532 531 if ( !silent) {533 if ((!instance->parea.mapped) || (console_override)) { 532 534 instance->addr[instance->cursor * 2] = glyph; 533 535 instance->addr[instance->cursor * 2 + 1] = style; … … 535 537 } 536 538 537 static void ega_putchar(outdev_t *dev, wchar_t ch , bool silent)539 static void ega_putchar(outdev_t *dev, wchar_t ch) 538 540 { 539 541 ega_instance_t *instance = (ega_instance_t *) dev->data; … … 555 557 break; 556 558 default: 557 ega_display_char(instance, ch , silent);559 ega_display_char(instance, ch); 558 560 instance->cursor++; 559 561 break; 560 562 } 561 ega_check_cursor(instance , silent);562 ega_move_cursor(instance , silent);563 ega_check_cursor(instance); 564 ega_move_cursor(instance); 563 565 564 566 irq_spinlock_unlock(&instance->lock, true); … … 572 574 573 575 memcpy(instance->addr, instance->backbuf, EGA_VRAM_SIZE); 574 ega_move_cursor(instance , silent);575 ega_show_cursor(instance , silent);576 ega_move_cursor(instance); 577 ega_show_cursor(instance); 576 578 577 579 irq_spinlock_unlock(&instance->lock, true); … … 612 614 } 613 615 616 link_initialize(&instance->parea.link); 617 instance->parea.pbase = addr; 618 instance->parea.frames = SIZE2FRAMES(EGA_VRAM_SIZE); 619 instance->parea.unpriv = false; 620 instance->parea.mapped = false; 621 ddi_parea_register(&instance->parea); 622 614 623 /* Synchronize the back buffer and cursor position. */ 615 624 memcpy(instance->backbuf, instance->addr, EGA_VRAM_SIZE); 616 ega_sync_cursor(instance , silent);625 ega_sync_cursor(instance); 617 626 618 627 if (!fb_exported) { 619 628 /* 620 * This is the necessary evil until the userspace driver is entirely 621 * self-sufficient. 629 * We export the kernel framebuffer for uspace usage. 630 * This is used in the case the uspace framebuffer 631 * driver is not self-sufficient. 622 632 */ 623 633 sysinfo_set_item_val("fb", NULL, true); -
kernel/genarch/src/drivers/s3c24xx_uart/s3c24xx_uart.c
ree2fa30a rb366a6f4 44 44 #include <arch/asm.h> 45 45 #include <mm/slab.h> 46 #include <mm/page.h> 46 47 #include <sysinfo/sysinfo.h> 47 48 #include <str.h> … … 59 60 } 60 61 61 static void s3c24xx_uart_putchar(outdev_t *dev, wchar_t ch , bool silent)62 static void s3c24xx_uart_putchar(outdev_t *dev, wchar_t ch) 62 63 { 63 if (!silent) { 64 s3c24xx_uart_t *uart = 65 (s3c24xx_uart_t *) dev->data; 66 67 if ((!uart->parea.mapped) || (console_override)) { 64 68 if (!ascii_check(ch)) { 65 69 s3c24xx_uart_sendb(dev, U_SPECIAL); 66 70 } else { 67 if (ch == '\n')71 if (ch == '\n') 68 72 s3c24xx_uart_sendb(dev, (uint8_t) '\r'); 69 73 s3c24xx_uart_sendb(dev, (uint8_t) ch); … … 93 97 }; 94 98 95 outdev_t *s3c24xx_uart_init( s3c24xx_uart_io_t *io, inr_t inr)99 outdev_t *s3c24xx_uart_init(uintptr_t paddr, inr_t inr) 96 100 { 97 101 outdev_t *uart_dev = malloc(sizeof(outdev_t), FRAME_ATOMIC); … … 109 113 uart_dev->data = uart; 110 114 111 uart->io = io;115 uart->io = (s3c24xx_uart_io_t *) hw_map(paddr, PAGE_SIZE); 112 116 uart->indev = NULL; 113 117 … … 127 131 pio_write_32(&uart->io->ucon, 128 132 pio_read_32(&uart->io->ucon) & ~UCON_RX_INT_LEVEL); 129 133 134 link_initialize(&uart->parea.link); 135 uart->parea.pbase = paddr; 136 uart->parea.frames = 1; 137 uart->parea.unpriv = false; 138 uart->parea.mapped = false; 139 ddi_parea_register(&uart->parea); 140 130 141 if (!fb_exported) { 131 142 /* 132 * This is the necessary evil until the userspace driver is entirely 143 * This is the necessary evil until 144 * the userspace driver is entirely 133 145 * self-sufficient. 134 146 */ 135 147 sysinfo_set_item_val("fb", NULL, true); 136 148 sysinfo_set_item_val("fb.kind", NULL, 3); 137 sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(io));149 sysinfo_set_item_val("fb.address.physical", NULL, paddr); 138 150 139 151 fb_exported = true; -
kernel/genarch/src/fb/fb.c
ree2fa30a rb366a6f4 82 82 SPINLOCK_DECLARE(lock); 83 83 84 parea_t parea; 85 84 86 uint8_t *addr; 85 87 uint16_t *backbuf; … … 109 111 } fb_instance_t; 110 112 111 static void fb_putchar(outdev_t *dev, wchar_t ch , bool silent);113 static void fb_putchar(outdev_t *dev, wchar_t ch); 112 114 static void fb_redraw_internal(fb_instance_t *instance); 113 115 static void fb_redraw(outdev_t *dev); … … 215 217 * 216 218 */ 217 static void logo_hide(fb_instance_t *instance , bool silent)219 static void logo_hide(fb_instance_t *instance) 218 220 { 219 221 instance->ylogo = 0; … … 221 223 instance->rowtrim = instance->rows; 222 224 223 if ( !silent)225 if ((!instance->parea.mapped) || (console_override)) 224 226 fb_redraw_internal(instance); 225 227 } … … 229 231 */ 230 232 static void glyph_draw(fb_instance_t *instance, uint16_t glyph, 231 unsigned int col, unsigned int row, bool silent, booloverlay)233 unsigned int col, unsigned int row, bool overlay) 232 234 { 233 235 unsigned int x = COL2X(col); … … 236 238 237 239 if (y >= instance->ytrim) 238 logo_hide(instance , silent);240 logo_hide(instance); 239 241 240 242 if (!overlay) 241 243 instance->backbuf[BB_POS(instance, col, row)] = glyph; 242 244 243 if ( !silent) {245 if ((!instance->parea.mapped) || (console_override)) { 244 246 for (yd = 0; yd < FONT_SCANLINES; yd++) 245 247 memcpy(&instance->addr[FB_POS(instance, x, y + yd + instance->ylogo)], … … 253 255 * 254 256 */ 255 static void screen_scroll(fb_instance_t *instance , bool silent)257 static void screen_scroll(fb_instance_t *instance) 256 258 { 257 259 if (instance->ylogo > 0) { 258 logo_hide(instance , silent);260 logo_hide(instance); 259 261 return; 260 262 } 261 263 262 if ( !silent) {264 if ((!instance->parea.mapped) || (console_override)) { 263 265 unsigned int row; 264 266 … … 298 300 } 299 301 300 static void cursor_put(fb_instance_t *instance , bool silent)302 static void cursor_put(fb_instance_t *instance) 301 303 { 302 304 unsigned int col = instance->position % instance->cols; 303 305 unsigned int row = instance->position / instance->cols; 304 306 305 glyph_draw(instance, fb_font_glyph(U_CURSOR), col, row, silent,true);306 } 307 308 static void cursor_remove(fb_instance_t *instance , bool silent)307 glyph_draw(instance, fb_font_glyph(U_CURSOR), col, row, true); 308 } 309 310 static void cursor_remove(fb_instance_t *instance) 309 311 { 310 312 unsigned int col = instance->position % instance->cols; … … 312 314 313 315 glyph_draw(instance, instance->backbuf[BB_POS(instance, col, row)], 314 col, row, silent,true);316 col, row, true); 315 317 } 316 318 … … 362 364 * 363 365 */ 364 static void fb_putchar(outdev_t *dev, wchar_t ch , bool silent)366 static void fb_putchar(outdev_t *dev, wchar_t ch) 365 367 { 366 368 fb_instance_t *instance = (fb_instance_t *) dev->data; … … 369 371 switch (ch) { 370 372 case '\n': 371 cursor_remove(instance , silent);373 cursor_remove(instance); 372 374 instance->position += instance->cols; 373 375 instance->position -= instance->position % instance->cols; 374 376 break; 375 377 case '\r': 376 cursor_remove(instance , silent);378 cursor_remove(instance); 377 379 instance->position -= instance->position % instance->cols; 378 380 break; 379 381 case '\b': 380 cursor_remove(instance , silent);382 cursor_remove(instance); 381 383 if (instance->position % instance->cols) 382 384 instance->position--; 383 385 break; 384 386 case '\t': 385 cursor_remove(instance , silent);387 cursor_remove(instance); 386 388 do { 387 389 glyph_draw(instance, fb_font_glyph(' '), 388 390 instance->position % instance->cols, 389 instance->position / instance->cols, silent,false);391 instance->position / instance->cols, false); 390 392 instance->position++; 391 393 } while ((instance->position % 8) … … 395 397 glyph_draw(instance, fb_font_glyph(ch), 396 398 instance->position % instance->cols, 397 instance->position / instance->cols, silent,false);399 instance->position / instance->cols, false); 398 400 instance->position++; 399 401 } … … 401 403 if (instance->position >= instance->cols * instance->rows) { 402 404 instance->position -= instance->cols; 403 screen_scroll(instance , silent);404 } 405 406 cursor_put(instance , silent);405 screen_scroll(instance); 406 } 407 408 cursor_put(instance); 407 409 408 410 spinlock_unlock(&instance->lock); … … 555 557 556 558 spinlock_initialize(&instance->lock, "*fb.instance.lock"); 559 557 560 instance->rgb_conv = rgb_conv; 558 561 instance->pixelbytes = pixelbytes; … … 623 626 glyphs_render(instance); 624 627 628 link_initialize(&instance->parea.link); 629 instance->parea.pbase = props->addr; 630 instance->parea.frames = SIZE2FRAMES(fbsize); 631 instance->parea.unpriv = false; 632 instance->parea.mapped = false; 633 ddi_parea_register(&instance->parea); 634 625 635 if (!fb_exported) { 626 636 /* 627 * This is the necessary evil until the userspace driver is entirely 628 * self-sufficient. 637 * We export the kernel framebuffer for uspace usage. 638 * This is used in the case the uspace framebuffer 639 * driver is not self-sufficient. 629 640 */ 630 641 sysinfo_set_item_val("fb", NULL, true);
Note:
See TracChangeset
for help on using the changeset viewer.
