Example #1
0
void ezs_fb_init(void)
{
    CYG_FB_ON(FRAMEBUF);
    CYG_FB_FILL_BLOCK(FRAMEBUF, 0, 0, FB_WIDTH, FB_HEIGHT, 0);
	cursor.x = 0;
	cursor.y = 0;
}
Example #2
0
static void
fill_screen(void)
{
    int             result;

#define DEPTH   CYG_FB_DEPTH(FRAMEBUF)
#define WIDTH   CYG_FB_WIDTH(FRAMEBUF)
#define HEIGHT  CYG_FB_HEIGHT(FRAMEBUF)

    diag_printf("Frame buffer %s\n", STRING(FRAMEBUF));
    diag_printf("Depth %d, width %d, height %d\n", DEPTH, WIDTH, HEIGHT);

    result = CYG_FB_ON(FRAMEBUF);

    if (CYG_FB_FLAGS0(FRAMEBUF) & CYG_FB_FLAGS0_TRUE_COLOUR) {
        reset_colours_to_true();
    }

    // A white background
    CYG_FB_FILL_BLOCK(FRAMEBUF, 0, 0, WIDTH, HEIGHT, WHITE);
}
Example #3
0
void
cyg_start(void)
{
    int             i, j;
    int             x = 0, y = 0;
    int             result;
    cyg_ucount16    block_width;
    
    CYG_FB_PIXEL0_VAR(FRAMEBUF);
    CYG_FB_PIXEL1_VAR(FRAMEBUF);
    
#define DEPTH   CYG_FB_DEPTH(FRAMEBUF)
#define WIDTH   CYG_FB_WIDTH(FRAMEBUF)
#define HEIGHT  CYG_FB_HEIGHT(FRAMEBUF)    
    
    CYG_TEST_INIT();

    diag_printf("Frame buffer %s\n", STRING(FRAMEBUF));
    diag_printf("Depth %d, width %d, height %d\n", DEPTH, WIDTH, HEIGHT);
    
    result = CYG_FB_ON(FRAMEBUF);

    if (CYG_FB_FLAGS0(FRAMEBUF) & CYG_FB_FLAGS0_TRUE_COLOUR) {
        reset_colours_to_true();
    }
    
    // A white background
    CYG_FB_FILL_BLOCK(FRAMEBUF, 0, 0, WIDTH, HEIGHT, WHITE);
    // A black block in the middle, 25 pixels in.
    CYG_FB_FILL_BLOCK(FRAMEBUF, 32, 32, WIDTH - 64, HEIGHT - 64, BLACK);

    // Four diagonal lines in the corners. Red in the top left, blue in the top right,
    // green in the bottom left, and yellow in the bottom right.
    for (i = 0; i < 32; i++) {
        CYG_FB_WRITE_PIXEL(FRAMEBUF, i,               i,                RED);
        CYG_FB_WRITE_PIXEL(FRAMEBUF, (WIDTH - 1) - i, i,                BLUE);
        CYG_FB_WRITE_PIXEL(FRAMEBUF, i,               (HEIGHT - 1) - i, GREEN);
        CYG_FB_WRITE_PIXEL(FRAMEBUF, (WIDTH - 1) - i, (HEIGHT - 1) - i, YELLOW);
    }

    // Horizontal and vertical lines. Cyan at the top, magenta on the bottom,
    // brown on the left, lightgrey on the right.
    CYG_FB_WRITE_HLINE(FRAMEBUF, 32,         16,            WIDTH - 64, CYAN);
    CYG_FB_WRITE_HLINE(FRAMEBUF, 32,         HEIGHT - 16,   WIDTH - 64, MAGENTA);
    CYG_FB_WRITE_VLINE(FRAMEBUF, 16,         32,            HEIGHT - 64, BROWN);
    CYG_FB_WRITE_VLINE(FRAMEBUF, WIDTH - 16, 32,            HEIGHT - 64, LIGHTGREY);

    // Top left, diagonal lines away from 0,0 with increasing spacing horizontally
    for (i = 0; i < 16; i++) {
        CYG_FB_PIXEL0_SET(FRAMEBUF, i + 16, i);
        for (j = 0; j < 16; j++) {
            CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
            CYG_FB_PIXEL0_ADDX(FRAMEBUF, j);
        }
    }

    // Top right, diagonal lines away from the corner, with increasing spacing horizontally
    for (i = 0; i < 16; i++) {
        CYG_FB_PIXEL0_SET(FRAMEBUF, WIDTH - (i + 16), i);
        for (j = 0; j < 16; j++) {
            CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
            CYG_FB_PIXEL0_ADDX(FRAMEBUF, -1 * j);
        }
    }

    // Top left, diagonal lines away from the corner, with increasing spacing vertically
    for (i = 0; i < 16; i++) {
        CYG_FB_PIXEL0_SET(FRAMEBUF, i, i + 16);
        for (j = 0; j < 16; j++) {
            CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
            CYG_FB_PIXEL0_ADDY(FRAMEBUF, j);
        }
    }
    // Bottom left, diagonal lines away from the corner, with increasing spacing vertically
    for (i = 0; i < 16; i++) {
        CYG_FB_PIXEL0_SET(FRAMEBUF, i, HEIGHT - (i + 16));
        for (j = 0; j < 16; j++) {
            CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
            CYG_FB_PIXEL0_ADDY(FRAMEBUF, -1 * j);
        }
    }

    // Thin vertical bars in the top-middle of the screen, between the hline and the box.
    // Starting in the center and moving out with increasing spacing.
    for (j = 0; j < 8; j++) {
        CYG_FB_PIXEL0_SET(FRAMEBUF, (WIDTH / 2) - 2, 20 + j);
        CYG_FB_PIXEL0_GET(FRAMEBUF, x, y);
        CYG_FB_PIXEL1_SET(FRAMEBUF, x + 3, y);
        for (i = 0; i < 16; i++) {
            CYG_FB_PIXEL0_ADDX(FRAMEBUF, -1 * i);
            CYG_FB_PIXEL1_ADDX(FRAMEBUF, i);
            CYG_FB_PIXEL0_WRITE(FRAMEBUF, colours[i]);
            CYG_FB_PIXEL1_WRITE(FRAMEBUF, colours[i]);
        }
    }
    
    
    if (8 == DEPTH) {
        CYG_FB_WRITE_BLOCK(FRAMEBUF, 0, HEIGHT / 2, 8, 8, bitmap8, 0, 8);
    } else if (16 == DEPTH) {
        CYG_FB_WRITE_BLOCK(FRAMEBUF, 0, HEIGHT / 2, 8, 8, bitmap16, 0, 8);
    } else if (32 == DEPTH) {
        CYG_FB_WRITE_BLOCK(FRAMEBUF, 0, HEIGHT / 2, 8, 8, bitmap32, 0, 8);
    }

    block_width     = (WIDTH - 100) / 14;
    for (i = 1; i <= 14; i++) {
        CYG_FB_FILL_BLOCK(FRAMEBUF, 50 + ((i - 1) * block_width), 50, block_width, HEIGHT - 100, colours[i]);
    }

    CYG_TEST_EXIT("Done");
}