../net/rfb.o \
../video/tnt2.o \
../video/fb.o \
+ ../video/checksumrect.o \
drivers.o \
../lib/minilib.o \
../lib/doprnt.o \
#ifndef __FB_H
#define __FB_H
+#include <stdint.h>
+
struct fbdevice;
struct vmode;
} format_t;
typedef void (*getvmode_t)(void *);
+typedef uint32_t (*checksum_rect_t)(int x, int y, int width, int height);
struct vmode {
int text:1;
unsigned char *fbaddr;
void *priv;
getvmode_t getvmode;
+ checksum_rect_t checksum_rect;
struct vmode curmode;
};
--- /dev/null
+#include <stdint.h>
+#include <fb.h>
+
+uint32_t checksum_rect_generic32(int x, int y, int width, int height) {
+
+ /* Generic checksum_rect function for video modes with 32-bit pixels
+ * (i.e. fb->curmode.bytestride = 4).
+ */
+
+ int scanline = fb->curmode.xres * 4;
+ uint32_t * lineaddr;
+ int i, j;
+
+ uint32_t sum = 0;
+
+ for (i = 0; i < height; i++) {
+ lineaddr = (uint32_t *)(fb->fbaddr + (i + y) * scanline);
+
+ for (j = 0; j < width; j++) {
+ sum += lineaddr[j + x];
+ }
+ }
+
+ return sum;
+}
+
--- /dev/null
+#ifndef _CHECKSUM_RECT_C
+#define _CHECKSUM_RECT_H
+
+uint32_t checksum_rect_generic32(int x, int y, int width, int height);
+
+#endif
#include <fb.h>
#include <paging.h>
+#include "checksumrect.h"
+
static void tnt2_getvmode(void *priv);
static struct fbdevice tnt2_fb = {
tnt2_fb.curmode.format = FB_RGB888;
tnt2_fb.curmode.bytestride = 4;
tnt2_fb.curmode.text = 0;
+ tnt2_fb.checksum_rect = checksum_rect_generic32;
break;
case 0:
tnt2_fb.curmode.text = 1;