]> Joshua Wise's Git repositories - netwatch.git/blame - hardware/video/generic.c
Slightly permute the USB_LEGKEY stuff.
[netwatch.git] / hardware / video / generic.c
CommitLineData
98e930a2
JP
1/* generic.c
2 * Helper functions for dealing with generic RGB888 framebuffers
3 * NetWatch system management mode administration console
4 *
5 * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved.
6 * This program is free software; you can redistribute and/or modify it under
7 * the terms found in the file LICENSE in the root of this source tree.
8 *
9 */
10
0a9d0188
JP
11#include <stdint.h>
12#include <fb.h>
74032dae 13#include <crc32.h>
0a9d0188
JP
14
15uint32_t checksum_rect_generic32(int x, int y, int width, int height) {
16
17 /* Generic checksum_rect function for video modes with 32-bit pixels
18 * (i.e. fb->curmode.bytestride = 4).
19 */
20
21 int scanline = fb->curmode.xres * 4;
74032dae
JW
22 unsigned char * lineaddr;
23 int i;
0a9d0188
JP
24
25 uint32_t sum = 0;
26
27 for (i = 0; i < height; i++) {
67109eef 28 lineaddr = fb->fbaddr + (i + y) * scanline + (4 * x);
0a9d0188 29
f2da68c5 30 sum = crc32(lineaddr, width * 4, sum);
0a9d0188
JP
31 }
32
33 return sum;
34}
35
66cd7e82
JW
36void copy_pixels_generic32(char *buf, int x, int y, int width, int height)
37{
38 int cx, cy;
39 unsigned int *ibuf = (unsigned int *)buf;
40 unsigned int *fbuf;
ec5f9ca5 41 for (cy = 0; cy < height; cy++)
66cd7e82
JW
42 {
43 fbuf = (unsigned int *)fb->fbaddr;
ec5f9ca5
JP
44 fbuf += (cy + y) * (fb->curmode.xres) + x;
45 for (cx = 0; cx < width; cx++)
66cd7e82
JW
46 *(ibuf++) = *(fbuf++);
47 }
48}
This page took 0.029444 seconds and 4 git commands to generate.