Date: | 2011-04-28 01:20:59 (12 years 11 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 625d9877ab7c15000871555a0ce22bd0a3109e89 |
Message: | ubb-vga2.c: make frame buffer fully VGA-sized; more cleanup - ubb-vga2.c (frame, grab, session): keep all 480 lines in the frame buffer instead of duplicating them on output - ubb-vga2.c (bad): make "static" - ubb-vga2.c (session, main): removed the "single" argument - ubb-vga2.c (main): complain about timeouts only if any occurred |
Files: |
ubb-vga/ubb-vga2.c (5 diffs) |
Change Details
ubb-vga/ubb-vga2.c | ||
---|---|---|
36 | 36 | |
37 | 37 | |
38 | 38 | static uint8_t thres = 63; |
39 | int bad; | |
39 | static int bad; | |
40 | 40 | |
41 | 41 | /* ----- I/O pin assignment ------------------------------------------------ */ |
42 | 42 | |
... | ... | |
378 | 378 | *pddats = HSYNC; |
379 | 379 | until(line_cycles-US(0.79)); |
380 | 380 | |
381 | for (p = f; p != f+240*line_words; p += line_words) { | |
382 | line(p, p); | |
381 | for (p = f; p != f+480*line_words; p += line_words) | |
383 | 382 | line(p, p+line_words); |
384 | } | |
385 | 383 | |
386 | 384 | /* Back porch */ |
387 | 385 | hdelay(14); |
... | ... | |
462 | 460 | uint32_t pix; |
463 | 461 | uint8_t r, g, b; |
464 | 462 | |
465 | for (y = 0; y != 240; y++) | |
463 | for (y = 0; y != 240; y++) { | |
466 | 464 | for (x = 0; x != 320; x++) { |
467 | 465 | pix = *fb++; |
468 | 466 | r = pix >> 16; |
469 | 467 | g = pix >> 8; |
470 | 468 | b = pix; |
471 | *f++ = pattern(r >= thres, g >= thres, b >= thres); | |
469 | f[0] = f[320] = | |
470 | pattern(r >= thres, g >= thres, b >= thres); | |
471 | f++; | |
472 | 472 | } |
473 | f += 320; | |
474 | } | |
473 | 475 | } |
474 | 476 | |
475 | 477 | |
476 | 478 | /* ----- Command-line parsing and main loop -------------------------------- */ |
477 | 479 | |
478 | 480 | |
479 | static void session(int frames, int single) | |
481 | static void session(int frames) | |
480 | 482 | { |
481 | uint32_t f[2*240*line_words]; | |
483 | uint32_t f[2*240*(line_words+1)]; | |
482 | 484 | int i; |
483 | 485 | |
484 | 486 | memset(f, 0, sizeof(f)); |
... | ... | |
508 | 510 | int main(int argc, char *const *argv) |
509 | 511 | { |
510 | 512 | int frames; |
511 | int single = 1; | |
512 | 513 | int c; |
513 | 514 | |
514 | 515 | while ((c = getopt(argc, argv, "")) != EOF) |
... | ... | |
529 | 530 | } |
530 | 531 | |
531 | 532 | setup(); |
532 | session(frames, single); | |
533 | session(frames); | |
533 | 534 | cleanup(); |
534 | 535 | |
535 | printf("%d\n", bad); | |
536 | if (bad) | |
537 | printf("%d timeout%s\n", bad, bad == 1 ? "" : "s"); | |
536 | 538 | return 0; |
537 | 539 | } |
Branches:
master