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
3636
3737
3838static uint8_t thres = 63;
39int bad;
39static int bad;
4040
4141/* ----- I/O pin assignment ------------------------------------------------ */
4242
...... 
378378    *pddats = HSYNC;
379379    until(line_cycles-US(0.79));
380380
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)
383382        line(p, p+line_words);
384    }
385383
386384    /* Back porch */
387385    hdelay(14);
...... 
462460    uint32_t pix;
463461    uint8_t r, g, b;
464462
465    for (y = 0; y != 240; y++)
463    for (y = 0; y != 240; y++) {
466464        for (x = 0; x != 320; x++) {
467465            pix = *fb++;
468466            r = pix >> 16;
469467            g = pix >> 8;
470468            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++;
472472        }
473        f += 320;
474    }
473475}
474476
475477
476478/* ----- Command-line parsing and main loop -------------------------------- */
477479
478480
479static void session(int frames, int single)
481static void session(int frames)
480482{
481    uint32_t f[2*240*line_words];
483    uint32_t f[2*240*(line_words+1)];
482484    int i;
483485
484486    memset(f, 0, sizeof(f));
...... 
508510int main(int argc, char *const *argv)
509511{
510512    int frames;
511    int single = 1;
512513    int c;
513514
514515    while ((c = getopt(argc, argv, "")) != EOF)
...... 
529530    }
530531
531532    setup();
532    session(frames, single);
533    session(frames);
533534    cleanup();
534535
535printf("%d\n", bad);
536    if (bad)
537        printf("%d timeout%s\n", bad, bad == 1 ? "" : "s");
536538    return 0;
537539}

Archive Download the corresponding diff file

Branches:
master



interactive