FB test: fix wrong FB access-widths

ref #983
This commit is contained in:
Martin Stein 2013-12-02 11:28:06 +01:00 committed by Norman Feske
parent 1ba4e033a7
commit 576b9389cb

View File

@ -35,40 +35,44 @@ int main()
return -2;
}
/* drive framebuffer */
enum {
BLACK = 0x0,
BLUE = 0x1f,
GREEN = 0x7e0,
RED = 0xf800,
WHITE = 0xffff,
};
addr_t const fb_base = (addr_t)env()->rm_session()->attach(fb_ds_cap);
unsigned const fb_bpp = (unsigned)mode.bytes_per_pixel();
if (fb_bpp != 2) {
PERR("pixel format not supported");
return -1;
}
unsigned const fb_size = (unsigned)(mode.width() * mode.height() * fb_bpp);
while (1) {
enum {
BLACK = 0x0,
BLUE = 0x1f,
GREEN = 0x7e0,
RED = 0xf800,
WHITE = 0xffff,
};
for (addr_t o = 0; o < fb_size; o += fb_bpp)
*(unsigned volatile *)(fb_base + o) = BLACK;
*(uint16_t volatile *)(fb_base + o) = BLACK;
PINF("black");
timer.msleep(2000);
for (addr_t o = 0; o < fb_size; o += fb_bpp)
*(unsigned volatile *)(fb_base + o) = BLUE;
*(uint16_t volatile *)(fb_base + o) = BLUE;
PINF("blue");
timer.msleep(2000);
for (addr_t o = 0; o < fb_size; o += fb_bpp)
*(unsigned volatile *)(fb_base + o) = GREEN;
*(uint16_t volatile *)(fb_base + o) = GREEN;
PINF("green");
timer.msleep(2000);
for (addr_t o = 0; o < fb_size; o += fb_bpp)
*(unsigned volatile *)(fb_base + o) = RED;
*(uint16_t volatile *)(fb_base + o) = RED;
PINF("red");
timer.msleep(2000);
for (addr_t o = 0; o < fb_size; o += fb_bpp)
*(unsigned volatile *)(fb_base + o) = WHITE;
*(uint16_t volatile *)(fb_base + o) = WHITE;
PINF("white");
timer.msleep(2000);
unsigned i = 0;
for (addr_t o = 0; o < fb_size; o += fb_bpp, i++)
*(unsigned volatile *)(fb_base + o) = i;
*(uint16_t volatile *)(fb_base + o) = i;
PINF("all");
timer.msleep(2000);
}