blob: 6a352d62eecf2b737336cce422198c1fe357bc55 [file] [log] [blame]
Michael Schmitza1005012007-05-01 22:32:39 +02001/*
2 * linux/drivers/video/mfb.c -- Low level frame buffer operations for
3 * monochrome
4 *
5 * Created 5 Apr 1997 by Geert Uytterhoeven
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12#include <linux/module.h>
13#include <linux/string.h>
14#include <linux/fb.h>
15
16#include "atafb.h"
17#include "atafb_utils.h"
18
19
20 /*
21 * Monochrome
22 */
23
24void atafb_mfb_copyarea(struct fb_info *info, u_long next_line,
25 int sy, int sx, int dy, int dx,
26 int height, int width)
27{
28 u8 *src, *dest;
29 u_int rows;
30
31 if (sx == 0 && dx == 0 && width == next_line) {
32 src = (u8 *)info->screen_base + sy * (width >> 3);
33 dest = (u8 *)info->screen_base + dy * (width >> 3);
34 fb_memmove(dest, src, height * (width >> 3));
35 } else if (dy <= sy) {
36 src = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
37 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
38 for (rows = height; rows--;) {
39 fb_memmove(dest, src, width >> 3);
40 src += next_line;
41 dest += next_line;
42 }
43 } else {
44 src = (u8 *)info->screen_base + (sy + height - 1) * next_line + (sx >> 3);
45 dest = (u8 *)info->screen_base + (dy + height - 1) * next_line + (dx >> 3);
46 for (rows = height; rows--;) {
47 fb_memmove(dest, src, width >> 3);
48 src -= next_line;
49 dest -= next_line;
50 }
51 }
52}
53
54void atafb_mfb_fillrect(struct fb_info *info, u_long next_line, u32 color,
55 int sy, int sx, int height, int width)
56{
57 u8 *dest;
58 u_int rows;
59
60 dest = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
61
62 if (sx == 0 && width == next_line) {
63 if (color)
64 fb_memset255(dest, height * (width >> 3));
65 else
66 fb_memclear(dest, height * (width >> 3));
67 } else {
68 for (rows = height; rows--; dest += next_line) {
69 if (color)
70 fb_memset255(dest, width >> 3);
71 else
72 fb_memclear_small(dest, width >> 3);
73 }
74 }
75}
76
77void atafb_mfb_linefill(struct fb_info *info, u_long next_line,
78 int dy, int dx, u32 width,
79 const u8 *data, u32 bgcolor, u32 fgcolor)
80{
81 u8 *dest;
82 u_int rows;
83
84 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
85
86 for (rows = width / 8; rows--; /* check margins */ ) {
87 // use fast_memmove or fb_memmove
88 *dest++ = *data++;
89 }
90}
91
92#ifdef MODULE
93MODULE_LICENSE("GPL");
94
95int init_module(void)
96{
97 return 0;
98}
99
100void cleanup_module(void)
101{
102}
103#endif /* MODULE */
104
105
106 /*
107 * Visible symbols for modules
108 */
109
110EXPORT_SYMBOL(atafb_mfb_copyarea);
111EXPORT_SYMBOL(atafb_mfb_fillrect);
112EXPORT_SYMBOL(atafb_mfb_linefill);