Root/
| 1 | /* |
| 2 | * grabfb.c - Grab the Ben's main frame buffer |
| 3 | * |
| 4 | * Written 2011 by Werner Almesberger |
| 5 | * Copyright 2011 Werner Almesberger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | #include <stdint.h> |
| 15 | #include <assert.h> |
| 16 | |
| 17 | #include "ubb-vga.h" |
| 18 | |
| 19 | |
| 20 | void grabfb(void **f, int xres, int yres) |
| 21 | { |
| 22 | uint32_t *fb = map(0x01d00000, 4*320*240); |
| 23 | uint8_t *p, *q; |
| 24 | int x, y; |
| 25 | uint32_t pix; |
| 26 | uint8_t r, g, b; |
| 27 | |
| 28 | assert(xres == 640); |
| 29 | assert(yres == 480); |
| 30 | for (y = 0; y != 240; y++) { |
| 31 | p = f[y*2]; |
| 32 | q = f[y*2+1]; |
| 33 | for (x = 0; x != 320; x++) { |
| 34 | pix = *fb++; |
| 35 | r = pix >> 16; |
| 36 | g = pix >> 8; |
| 37 | b = pix; |
| 38 | *p = *q = ccube_map(r, g, b)*0x11; |
| 39 | p++; |
| 40 | q++; |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 |
Branches:
master
