Rev 1875 | Rev 1981 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1875 | Rev 1888 | ||
|---|---|---|---|
| Line 302... | Line 302... | ||
| 302 | static void fb_putchar(chardev_t *dev, char ch) |
302 | static void fb_putchar(chardev_t *dev, char ch) |
| 303 | { |
303 | { |
| 304 | spinlock_lock(&fb_lock); |
304 | spinlock_lock(&fb_lock); |
| 305 | 305 | ||
| 306 | switch (ch) { |
306 | switch (ch) { |
| 307 | case '\n': |
307 | case '\n': |
| 308 | invert_cursor(); |
308 | invert_cursor(); |
| 309 | position += columns; |
309 | position += columns; |
| 310 | position -= position % columns; |
310 | position -= position % columns; |
| 311 | break; |
311 | break; |
| 312 | case '\r': |
312 | case '\r': |
| 313 | invert_cursor(); |
313 | invert_cursor(); |
| 314 | position -= position % columns; |
314 | position -= position % columns; |
| 315 | break; |
315 | break; |
| 316 | case '\b': |
316 | case '\b': |
| 317 | invert_cursor(); |
317 | invert_cursor(); |
| 318 | if (position % columns) |
318 | if (position % columns) |
| 319 | position--; |
319 | position--; |
| 320 | break; |
320 | break; |
| 321 | case '\t': |
321 | case '\t': |
| 322 | invert_cursor(); |
322 | invert_cursor(); |
| 323 | do { |
323 | do { |
| 324 | draw_char(' '); |
324 | draw_char(' '); |
| 325 | position++; |
- | |
| 326 | } while ((position % 8) && position < columns * rows); |
- | |
| 327 | break; |
- | |
| 328 | default: |
- | |
| 329 | draw_char(ch); |
- | |
| 330 | position++; |
325 | position++; |
| - | 326 | } while ((position % 8) && position < columns * rows); |
|
| - | 327 | break; |
|
| - | 328 | default: |
|
| - | 329 | draw_char(ch); |
|
| - | 330 | position++; |
|
| 331 | } |
331 | } |
| 332 | 332 | ||
| 333 | if (position >= columns * rows) { |
333 | if (position >= columns * rows) { |
| 334 | position -= columns; |
334 | position -= columns; |
| 335 | scroll_screen(); |
335 | scroll_screen(); |
| Line 356... | Line 356... | ||
| 356 | * @param align Request alignment for 24bpp mode. |
356 | * @param align Request alignment for 24bpp mode. |
| 357 | */ |
357 | */ |
| 358 | void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align) |
358 | void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align) |
| 359 | { |
359 | { |
| 360 | switch (bpp) { |
360 | switch (bpp) { |
| 361 | case 8: |
361 | case 8: |
| 362 | rgb2scr = rgb_1byte; |
362 | rgb2scr = rgb_1byte; |
| 363 | scr2rgb = byte1_rgb; |
363 | scr2rgb = byte1_rgb; |
| 364 | pixelbytes = 1; |
364 | pixelbytes = 1; |
| 365 | break; |
365 | break; |
| 366 | case 16: |
366 | case 16: |
| 367 | rgb2scr = rgb_2byte; |
367 | rgb2scr = rgb_2byte; |
| 368 | scr2rgb = byte2_rgb; |
368 | scr2rgb = byte2_rgb; |
| 369 | pixelbytes = 2; |
369 | pixelbytes = 2; |
| 370 | break; |
370 | break; |
| 371 | case 24: |
371 | case 24: |
| 372 | rgb2scr = rgb_3byte; |
372 | rgb2scr = rgb_3byte; |
| 373 | scr2rgb = byte3_rgb; |
373 | scr2rgb = byte3_rgb; |
| 374 | if (align) |
374 | if (align) |
| 375 | pixelbytes = 4; |
- | |
| 376 | else |
- | |
| 377 | pixelbytes = 3; |
- | |
| 378 | break; |
- | |
| 379 | case 32: |
- | |
| 380 | rgb2scr = rgb_4byte; |
- | |
| 381 | scr2rgb = byte4_rgb; |
- | |
| 382 | pixelbytes = 4; |
375 | pixelbytes = 4; |
| - | 376 | else |
|
| - | 377 | pixelbytes = 3; |
|
| 383 | break; |
378 | break; |
| - | 379 | case 32: |
|
| - | 380 | rgb2scr = rgb_4byte; |
|
| - | 381 | scr2rgb = byte4_rgb; |
|
| - | 382 | pixelbytes = 4; |
|
| - | 383 | break; |
|
| 384 | default: |
384 | default: |
| 385 | panic("Unsupported bpp"); |
385 | panic("Unsupported bpp"); |
| 386 | } |
386 | } |
| 387 | 387 | ||
| 388 | unsigned int fbsize = scan * y; |
388 | unsigned int fbsize = scan * y; |
| 389 | 389 | ||
| 390 | /* Map the framebuffer */ |
390 | /* Map the framebuffer */ |