Rev 1490 | Rev 1498 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1490 | Rev 1493 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2006 Jakub Vana |
2 | * Copyright (C) 2006 Jakub Vana |
3 | * Copyright (C) 2006 Ondrej Palkovsky |
3 | * Copyright (C) 2006 Ondrej Palkovsky |
4 | * All rights reserved. |
4 | * All rights reserved. |
5 | * |
5 | * |
6 | * Redistribution and use in source and binary forms, with or without |
6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions |
7 | * modification, are permitted provided that the following conditions |
8 | * are met: |
8 | * are met: |
9 | * |
9 | * |
10 | * - Redistributions of source code must retain the above copyright |
10 | * - Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. |
11 | * notice, this list of conditions and the following disclaimer. |
12 | * - Redistributions in binary form must reproduce the above copyright |
12 | * - Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the |
13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. |
14 | * documentation and/or other materials provided with the distribution. |
15 | * - The name of the author may not be used to endorse or promote products |
15 | * - The name of the author may not be used to endorse or promote products |
16 | * derived from this software without specific prior written permission. |
16 | * derived from this software without specific prior written permission. |
17 | * |
17 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ |
28 | */ |
29 | 29 | ||
30 | #include <stdlib.h> |
30 | #include <stdlib.h> |
31 | #include <unistd.h> |
31 | #include <unistd.h> |
32 | #include <string.h> |
32 | #include <string.h> |
33 | #include <ddi.h> |
33 | #include <ddi.h> |
34 | #include <sysinfo.h> |
34 | #include <sysinfo.h> |
35 | #include <align.h> |
35 | #include <align.h> |
36 | #include <as.h> |
36 | #include <as.h> |
37 | #include <ipc/fb.h> |
37 | #include <ipc/fb.h> |
38 | #include <ipc/ipc.h> |
38 | #include <ipc/ipc.h> |
39 | #include <ipc/ns.h> |
39 | #include <ipc/ns.h> |
40 | #include <ipc/services.h> |
40 | #include <ipc/services.h> |
41 | #include <kernel/errno.h> |
41 | #include <kernel/errno.h> |
42 | #include <async.h> |
42 | #include <async.h> |
43 | #include "font-8x16.h" |
43 | #include "font-8x16.h" |
44 | #include "helenos.xbm" |
44 | #include "helenos.xbm" |
45 | #include "fb.h" |
45 | #include "fb.h" |
46 | 46 | ||
47 | #define DEFAULT_BGCOLOR 0x000080 |
47 | #define DEFAULT_BGCOLOR 0x000080 |
48 | #define DEFAULT_FGCOLOR 0xffff00 |
48 | #define DEFAULT_FGCOLOR 0xffff00 |
49 | 49 | ||
50 | /***************************************************************/ |
50 | /***************************************************************/ |
51 | /* Pixel specific fuctions */ |
51 | /* Pixel specific fuctions */ |
52 | 52 | ||
53 | typedef void (*putpixel_fn_t)(unsigned int x, unsigned int y, int color); |
53 | typedef void (*putpixel_fn_t)(unsigned int x, unsigned int y, int color); |
54 | typedef int (*getpixel_fn_t)(unsigned int x, unsigned int y); |
54 | typedef int (*getpixel_fn_t)(unsigned int x, unsigned int y); |
55 | 55 | ||
56 | struct { |
56 | struct { |
57 | __u8 *fbaddress ; |
57 | __u8 *fbaddress ; |
58 | 58 | ||
59 | unsigned int xres ; |
59 | unsigned int xres ; |
60 | unsigned int yres ; |
60 | unsigned int yres ; |
61 | unsigned int scanline ; |
61 | unsigned int scanline ; |
62 | unsigned int pixelbytes ; |
62 | unsigned int pixelbytes ; |
63 | 63 | ||
64 | putpixel_fn_t putpixel; |
64 | putpixel_fn_t putpixel; |
65 | getpixel_fn_t getpixel; |
65 | getpixel_fn_t getpixel; |
66 | } screen; |
66 | } screen; |
67 | 67 | ||
68 | typedef struct { |
68 | typedef struct { |
69 | int initialized; |
69 | int initialized; |
70 | unsigned int x, y; |
70 | unsigned int x, y; |
71 | unsigned int width, height; |
71 | unsigned int width, height; |
72 | 72 | ||
73 | /* Text support in window */ |
73 | /* Text support in window */ |
74 | unsigned int rows, cols; |
74 | unsigned int rows, cols; |
75 | /* Style for text printing */ |
75 | /* Style for text printing */ |
76 | int bgcolor, fgcolor; |
76 | int bgcolor, fgcolor; |
77 | /* Auto-cursor position */ |
77 | /* Auto-cursor position */ |
78 | int cursor_active, cur_col, cur_row; |
78 | int cursor_active, cur_col, cur_row; |
79 | } viewport_t; |
79 | } viewport_t; |
80 | 80 | ||
81 | #define MAX_VIEWPORTS 128 |
81 | #define MAX_VIEWPORTS 128 |
82 | static viewport_t viewports[128]; |
82 | static viewport_t viewports[128]; |
83 | 83 | ||
84 | /* Allow only 1 connection */ |
84 | /* Allow only 1 connection */ |
85 | static int client_connected = 0; |
85 | static int client_connected = 0; |
86 | 86 | ||
87 | #define RED(x, bits) ((x >> (16 + 8 - bits)) & ((1 << bits) - 1)) |
87 | #define RED(x, bits) ((x >> (16 + 8 - bits)) & ((1 << bits) - 1)) |
88 | #define GREEN(x, bits) ((x >> (8 + 8 - bits)) & ((1 << bits) - 1)) |
88 | #define GREEN(x, bits) ((x >> (8 + 8 - bits)) & ((1 << bits) - 1)) |
89 | #define BLUE(x, bits) ((x >> (8 - bits)) & ((1 << bits) - 1)) |
89 | #define BLUE(x, bits) ((x >> (8 - bits)) & ((1 << bits) - 1)) |
90 | 90 | ||
91 | #define COL_WIDTH 8 |
91 | #define COL_WIDTH 8 |
92 | #define ROW_BYTES (screen.scanline * FONT_SCANLINES) |
92 | #define ROW_BYTES (screen.scanline * FONT_SCANLINES) |
93 | 93 | ||
94 | #define POINTPOS(x, y) ((y) * screen.scanline + (x) * screen.pixelbytes) |
94 | #define POINTPOS(x, y) ((y) * screen.scanline + (x) * screen.pixelbytes) |
95 | 95 | ||
96 | /** Put pixel - 24-bit depth, 1 free byte */ |
96 | /** Put pixel - 24-bit depth, 1 free byte */ |
97 | static void putpixel_4byte(unsigned int x, unsigned int y, int color) |
97 | static void putpixel_4byte(unsigned int x, unsigned int y, int color) |
98 | { |
98 | { |
99 | *((__u32 *)(screen.fbaddress + POINTPOS(x, y))) = color; |
99 | *((__u32 *)(screen.fbaddress + POINTPOS(x, y))) = color; |
100 | } |
100 | } |
101 | 101 | ||
102 | /** Return pixel color - 24-bit depth, 1 free byte */ |
102 | /** Return pixel color - 24-bit depth, 1 free byte */ |
103 | static int getpixel_4byte(unsigned int x, unsigned int y) |
103 | static int getpixel_4byte(unsigned int x, unsigned int y) |
104 | { |
104 | { |
105 | return *((__u32 *)(screen.fbaddress + POINTPOS(x, y))) & 0xffffff; |
105 | return *((__u32 *)(screen.fbaddress + POINTPOS(x, y))) & 0xffffff; |
106 | } |
106 | } |
107 | 107 | ||
108 | /** Put pixel - 24-bit depth */ |
108 | /** Put pixel - 24-bit depth */ |
109 | static void putpixel_3byte(unsigned int x, unsigned int y, int color) |
109 | static void putpixel_3byte(unsigned int x, unsigned int y, int color) |
110 | { |
110 | { |
111 | unsigned int startbyte = POINTPOS(x, y); |
111 | unsigned int startbyte = POINTPOS(x, y); |
112 | 112 | ||
113 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
113 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
114 | screen.fbaddress[startbyte] = RED(color, 8); |
114 | screen.fbaddress[startbyte] = RED(color, 8); |
115 | screen.fbaddress[startbyte + 1] = GREEN(color, 8); |
115 | screen.fbaddress[startbyte + 1] = GREEN(color, 8); |
116 | screen.fbaddress[startbyte + 2] = BLUE(color, 8); |
116 | screen.fbaddress[startbyte + 2] = BLUE(color, 8); |
117 | #else |
117 | #else |
118 | screen.fbaddress[startbyte + 2] = RED(color, 8); |
118 | screen.fbaddress[startbyte + 2] = RED(color, 8); |
119 | screen.fbaddress[startbyte + 1] = GREEN(color, 8); |
119 | screen.fbaddress[startbyte + 1] = GREEN(color, 8); |
120 | screen.fbaddress[startbyte + 0] = BLUE(color, 8); |
120 | screen.fbaddress[startbyte + 0] = BLUE(color, 8); |
121 | #endif |
121 | #endif |
122 | 122 | ||
123 | } |
123 | } |
124 | 124 | ||
125 | /** Return pixel color - 24-bit depth */ |
125 | /** Return pixel color - 24-bit depth */ |
126 | static int getpixel_3byte(unsigned int x, unsigned int y) |
126 | static int getpixel_3byte(unsigned int x, unsigned int y) |
127 | { |
127 | { |
128 | unsigned int startbyte = POINTPOS(x, y); |
128 | unsigned int startbyte = POINTPOS(x, y); |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
132 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
133 | return screen.fbaddress[startbyte] << 16 | screen.fbaddress[startbyte + 1] << 8 | screen.fbaddress[startbyte + 2]; |
133 | return screen.fbaddress[startbyte] << 16 | screen.fbaddress[startbyte + 1] << 8 | screen.fbaddress[startbyte + 2]; |
134 | #else |
134 | #else |
135 | return screen.fbaddress[startbyte + 2] << 16 | screen.fbaddress[startbyte + 1] << 8 | screen.fbaddress[startbyte + 0]; |
135 | return screen.fbaddress[startbyte + 2] << 16 | screen.fbaddress[startbyte + 1] << 8 | screen.fbaddress[startbyte + 0]; |
136 | #endif |
136 | #endif |
137 | 137 | ||
138 | 138 | ||
139 | } |
139 | } |
140 | 140 | ||
141 | /** Put pixel - 16-bit depth (5:6:5) */ |
141 | /** Put pixel - 16-bit depth (5:6:5) */ |
142 | static void putpixel_2byte(unsigned int x, unsigned int y, int color) |
142 | static void putpixel_2byte(unsigned int x, unsigned int y, int color) |
143 | { |
143 | { |
144 | /* 5-bit, 6-bits, 5-bits */ |
144 | /* 5-bit, 6-bits, 5-bits */ |
145 | *((__u16 *)(screen.fbaddress + POINTPOS(x, y))) = RED(color, 5) << 11 | GREEN(color, 6) << 5 | BLUE(color, 5); |
145 | *((__u16 *)(screen.fbaddress + POINTPOS(x, y))) = RED(color, 5) << 11 | GREEN(color, 6) << 5 | BLUE(color, 5); |
146 | } |
146 | } |
147 | 147 | ||
148 | /** Return pixel color - 16-bit depth (5:6:5) */ |
148 | /** Return pixel color - 16-bit depth (5:6:5) */ |
149 | static int getpixel_2byte(unsigned int x, unsigned int y) |
149 | static int getpixel_2byte(unsigned int x, unsigned int y) |
150 | { |
150 | { |
151 | int color = *((__u16 *)(screen.fbaddress + POINTPOS(x, y))); |
151 | int color = *((__u16 *)(screen.fbaddress + POINTPOS(x, y))); |
152 | return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); |
152 | return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); |
153 | } |
153 | } |
154 | 154 | ||
155 | /** Put pixel - 8-bit depth (3:2:3) */ |
155 | /** Put pixel - 8-bit depth (3:2:3) */ |
156 | static void putpixel_1byte(unsigned int x, unsigned int y, int color) |
156 | static void putpixel_1byte(unsigned int x, unsigned int y, int color) |
157 | { |
157 | { |
158 | screen.fbaddress[POINTPOS(x, y)] = RED(color, 3) << 5 | GREEN(color, 2) << 3 | BLUE(color, 3); |
158 | screen.fbaddress[POINTPOS(x, y)] = RED(color, 3) << 5 | GREEN(color, 2) << 3 | BLUE(color, 3); |
159 | } |
159 | } |
160 | 160 | ||
161 | /** Return pixel color - 8-bit depth (3:2:3) */ |
161 | /** Return pixel color - 8-bit depth (3:2:3) */ |
162 | static int getpixel_1byte(unsigned int x, unsigned int y) |
162 | static int getpixel_1byte(unsigned int x, unsigned int y) |
163 | { |
163 | { |
164 | int color = screen.fbaddress[POINTPOS(x, y)]; |
164 | int color = screen.fbaddress[POINTPOS(x, y)]; |
165 | return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); |
165 | return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); |
166 | } |
166 | } |
167 | 167 | ||
168 | static void putpixel(int vp, unsigned int x, unsigned int y, int color) |
168 | static void putpixel(int vp, unsigned int x, unsigned int y, int color) |
169 | { |
169 | { |
170 | screen.putpixel(viewports[vp].x + x, viewports[vp].y + y, color); |
170 | screen.putpixel(viewports[vp].x + x, viewports[vp].y + y, color); |
171 | } |
171 | } |
172 | static int getpixel(int vp, unsigned int x, unsigned int y) |
172 | static int getpixel(int vp, unsigned int x, unsigned int y) |
173 | { |
173 | { |
174 | return screen.getpixel(viewports[vp].x + x, viewports[vp].y + y); |
174 | return screen.getpixel(viewports[vp].x + x, viewports[vp].y + y); |
175 | } |
175 | } |
176 | 176 | ||
177 | /** Fill line with color BGCOLOR */ |
177 | /** Fill line with color BGCOLOR */ |
178 | static void clear_line(int vp, unsigned int y) |
178 | static void clear_line(int vp, unsigned int y) |
179 | { |
179 | { |
180 | unsigned int x; |
180 | unsigned int x; |
181 | for (x = 0; x < viewports[vp].width; x++) |
181 | for (x = 0; x < viewports[vp].width; x++) |
182 | putpixel(vp, x, y, viewports[vp].bgcolor); |
182 | putpixel(vp, x, y, viewports[vp].bgcolor); |
183 | } |
183 | } |
184 | 184 | ||
185 | /** Fill viewport with background color */ |
185 | /** Fill viewport with background color */ |
186 | static void clear_port(int vp) |
186 | static void clear_port(int vp) |
187 | { |
187 | { |
188 | unsigned int y; |
188 | unsigned int y; |
189 | 189 | ||
190 | clear_line(vp, 0); |
190 | clear_line(vp, 0); |
191 | for (y = viewports[vp].y+1; y < viewports[vp].y+viewports[vp].height; y++) { |
191 | for (y = viewports[vp].y+1; y < viewports[vp].y+viewports[vp].height; y++) { |
192 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
192 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
193 | &screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y)], |
193 | &screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y)], |
194 | screen.pixelbytes * viewports[vp].width); |
194 | screen.pixelbytes * viewports[vp].width); |
195 | } |
195 | } |
196 | } |
196 | } |
197 | 197 | ||
198 | /** Scroll port up/down |
198 | /** Scroll port up/down |
199 | * |
199 | * |
200 | * @param vp Viewport to scroll |
200 | * @param vp Viewport to scroll |
201 | * @param rows Positive number - scroll up, negative - scroll down |
201 | * @param rows Positive number - scroll up, negative - scroll down |
202 | */ |
202 | */ |
203 | static void scroll_port(int vp, int rows) |
203 | static void scroll_port(int vp, int rows) |
204 | { |
204 | { |
205 | int y; |
205 | int y; |
206 | int startline; |
206 | int startline; |
207 | int endline; |
207 | int endline; |
208 | 208 | ||
209 | if (rows > 0) { |
209 | if (rows > 0) { |
210 | for (y=viewports[vp].y; y < viewports[vp].y+viewports[vp].height - rows*FONT_SCANLINES; y++) |
210 | for (y=viewports[vp].y; y < viewports[vp].y+viewports[vp].height - rows*FONT_SCANLINES; y++) |
211 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
211 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
212 | &screen.fbaddress[POINTPOS(viewports[vp].x,y + rows*FONT_SCANLINES)], |
212 | &screen.fbaddress[POINTPOS(viewports[vp].x,y + rows*FONT_SCANLINES)], |
213 | screen.pixelbytes * viewports[vp].width); |
213 | screen.pixelbytes * viewports[vp].width); |
214 | /* Clear last row */ |
214 | /* Clear last row */ |
215 | startline = viewports[vp].y+FONT_SCANLINES*(viewports[vp].rows-1); |
215 | startline = viewports[vp].y+FONT_SCANLINES*(viewports[vp].rows-1); |
216 | endline = viewports[vp].y + viewports[vp].height; |
216 | endline = viewports[vp].y + viewports[vp].height; |
217 | clear_line(vp, startline); |
217 | clear_line(vp, startline); |
218 | for (y=startline+1;y < endline; y++) |
218 | for (y=startline+1;y < endline; y++) |
219 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
219 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
220 | &screen.fbaddress[POINTPOS(viewports[vp].x,startline)], |
220 | &screen.fbaddress[POINTPOS(viewports[vp].x,startline)], |
221 | screen.pixelbytes * viewports[vp].width); |
221 | screen.pixelbytes * viewports[vp].width); |
222 | 222 | ||
223 | } else if (rows < 0) { |
223 | } else if (rows < 0) { |
224 | rows = -rows; |
224 | rows = -rows; |
225 | for (y=viewports[vp].y + viewports[vp].height-1; y >= viewports[vp].y + rows*FONT_SCANLINES; y--) |
225 | for (y=viewports[vp].y + viewports[vp].height-1; y >= viewports[vp].y + rows*FONT_SCANLINES; y--) |
226 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
226 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], |
227 | &screen.fbaddress[POINTPOS(viewports[vp].x,y - rows*FONT_SCANLINES)], |
227 | &screen.fbaddress[POINTPOS(viewports[vp].x,y - rows*FONT_SCANLINES)], |
228 | screen.pixelbytes * viewports[vp].width); |
228 | screen.pixelbytes * viewports[vp].width); |
229 | /* Clear first row */ |
229 | /* Clear first row */ |
230 | clear_line(0, viewports[vp].bgcolor); |
230 | clear_line(0, viewports[vp].bgcolor); |
231 | for (y=1;y < rows*FONT_SCANLINES; y++) |
231 | for (y=1;y < rows*FONT_SCANLINES; y++) |
232 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y+y)], |
232 | memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y+y)], |
233 | &screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y)], |
233 | &screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y)], |
234 | screen.pixelbytes * viewports[vp].width); |
234 | screen.pixelbytes * viewports[vp].width); |
235 | } |
235 | } |
236 | } |
236 | } |
237 | 237 | ||
238 | static void invert_pixel(int vp,unsigned int x, unsigned int y) |
238 | static void invert_pixel(int vp,unsigned int x, unsigned int y) |
239 | { |
239 | { |
240 | putpixel(vp, x, y, ~getpixel(vp, x, y)); |
240 | putpixel(vp, x, y, ~getpixel(vp, x, y)); |
241 | } |
241 | } |
242 | 242 | ||
243 | 243 | ||
244 | /** Draw one line of glyph at a given position */ |
244 | /** Draw one line of glyph at a given position */ |
245 | static void draw_glyph_line(int vp,unsigned int glline, unsigned int x, unsigned int y) |
245 | static void draw_glyph_line(int vp,unsigned int glline, unsigned int x, unsigned int y) |
246 | { |
246 | { |
247 | unsigned int i; |
247 | unsigned int i; |
248 | 248 | ||
249 | for (i = 0; i < 8; i++) |
249 | for (i = 0; i < 8; i++) |
250 | if (glline & (1 << (7 - i))) { |
250 | if (glline & (1 << (7 - i))) { |
251 | putpixel(vp, x + i, y, viewports[vp].fgcolor); |
251 | putpixel(vp, x + i, y, viewports[vp].fgcolor); |
252 | } else |
252 | } else |
253 | putpixel(vp, x + i, y, viewports[vp].bgcolor); |
253 | putpixel(vp, x + i, y, viewports[vp].bgcolor); |
254 | } |
254 | } |
255 | 255 | ||
256 | /***************************************************************/ |
256 | /***************************************************************/ |
257 | /* Character-console functions */ |
257 | /* Character-console functions */ |
258 | 258 | ||
259 | /** Draw character at given position */ |
259 | /** Draw character at given position */ |
260 | static void draw_glyph(int vp,__u8 glyph, unsigned int row, unsigned int col) |
260 | static void draw_glyph(int vp,__u8 glyph, unsigned int row, unsigned int col) |
261 | { |
261 | { |
262 | unsigned int y; |
262 | unsigned int y; |
263 | 263 | ||
264 | for (y = 0; y < FONT_SCANLINES; y++) |
264 | for (y = 0; y < FONT_SCANLINES; y++) |
265 | draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y); |
265 | draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y); |
266 | } |
266 | } |
267 | 267 | ||
268 | /** Invert character at given position */ |
268 | /** Invert character at given position */ |
269 | static void invert_char(int vp,unsigned int row, unsigned int col) |
269 | static void invert_char(int vp,unsigned int row, unsigned int col) |
270 | { |
270 | { |
271 | unsigned int x; |
271 | unsigned int x; |
272 | unsigned int y; |
272 | unsigned int y; |
273 | 273 | ||
274 | for (x = 0; x < COL_WIDTH; x++) |
274 | for (x = 0; x < COL_WIDTH; x++) |
275 | for (y = 0; y < FONT_SCANLINES; y++) |
275 | for (y = 0; y < FONT_SCANLINES; y++) |
276 | invert_pixel(vp, col * COL_WIDTH + x, row * FONT_SCANLINES + y); |
276 | invert_pixel(vp, col * COL_WIDTH + x, row * FONT_SCANLINES + y); |
277 | } |
277 | } |
278 | 278 | ||
279 | static void draw_logo(int vp,unsigned int startx, unsigned int starty) |
279 | static void draw_logo(int vp,unsigned int startx, unsigned int starty) |
280 | { |
280 | { |
281 | unsigned int x; |
281 | unsigned int x; |
282 | unsigned int y; |
282 | unsigned int y; |
283 | unsigned int byte; |
283 | unsigned int byte; |
284 | unsigned int rowbytes; |
284 | unsigned int rowbytes; |
285 | 285 | ||
286 | rowbytes = (helenos_width - 1) / 8 + 1; |
286 | rowbytes = (helenos_width - 1) / 8 + 1; |
287 | 287 | ||
288 | for (y = 0; y < helenos_height; y++) |
288 | for (y = 0; y < helenos_height; y++) |
289 | for (x = 0; x < helenos_width; x++) { |
289 | for (x = 0; x < helenos_width; x++) { |
290 | byte = helenos_bits[rowbytes * y + x / 8]; |
290 | byte = helenos_bits[rowbytes * y + x / 8]; |
291 | byte >>= x % 8; |
291 | byte >>= x % 8; |
292 | if (byte & 1) |
292 | if (byte & 1) |
293 | putpixel(vp ,startx + x, starty + y, viewports[vp].fgcolor); |
293 | putpixel(vp ,startx + x, starty + y, viewports[vp].fgcolor); |
294 | } |
294 | } |
295 | } |
295 | } |
296 | 296 | ||
297 | /***************************************************************/ |
297 | /***************************************************************/ |
298 | /* Stdout specific functions */ |
298 | /* Stdout specific functions */ |
299 | 299 | ||
300 | 300 | ||
301 | /** Create new viewport |
301 | /** Create new viewport |
302 | * |
302 | * |
303 | * @return New viewport number |
303 | * @return New viewport number |
304 | */ |
304 | */ |
305 | static int viewport_create(unsigned int x, unsigned int y,unsigned int width, |
305 | static int viewport_create(unsigned int x, unsigned int y,unsigned int width, |
306 | unsigned int height) |
306 | unsigned int height) |
307 | { |
307 | { |
308 | int i; |
308 | int i; |
309 | 309 | ||
310 | for (i=0; i < MAX_VIEWPORTS; i++) { |
310 | for (i=0; i < MAX_VIEWPORTS; i++) { |
311 | if (!viewports[i].initialized) |
311 | if (!viewports[i].initialized) |
312 | break; |
312 | break; |
313 | } |
313 | } |
314 | if (i == MAX_VIEWPORTS) |
314 | if (i == MAX_VIEWPORTS) |
315 | return ELIMIT; |
315 | return ELIMIT; |
316 | 316 | ||
317 | if (width ==0 || height == 0 || |
317 | if (width ==0 || height == 0 || |
318 | x+width > screen.xres || y+height > screen.yres) |
318 | x+width > screen.xres || y+height > screen.yres) |
319 | return EINVAL; |
319 | return EINVAL; |
320 | if (width < FONT_SCANLINES || height < COL_WIDTH) |
320 | if (width < FONT_SCANLINES || height < COL_WIDTH) |
321 | return EINVAL; |
321 | return EINVAL; |
322 | 322 | ||
323 | viewports[i].x = x; |
323 | viewports[i].x = x; |
324 | viewports[i].y = y; |
324 | viewports[i].y = y; |
325 | viewports[i].width = width; |
325 | viewports[i].width = width; |
326 | viewports[i].height = height; |
326 | viewports[i].height = height; |
327 | 327 | ||
328 | viewports[i].rows = height / FONT_SCANLINES; |
328 | viewports[i].rows = height / FONT_SCANLINES; |
329 | viewports[i].cols = width / COL_WIDTH; |
329 | viewports[i].cols = width / COL_WIDTH; |
330 | 330 | ||
331 | viewports[i].bgcolor = DEFAULT_BGCOLOR; |
331 | viewports[i].bgcolor = DEFAULT_BGCOLOR; |
332 | viewports[i].fgcolor = DEFAULT_FGCOLOR; |
332 | viewports[i].fgcolor = DEFAULT_FGCOLOR; |
333 | 333 | ||
334 | viewports[i].cur_col = 0; |
334 | viewports[i].cur_col = 0; |
335 | viewports[i].cur_row = 0; |
335 | viewports[i].cur_row = 0; |
336 | viewports[i].cursor_active = 0; |
336 | viewports[i].cursor_active = 0; |
337 | 337 | ||
338 | viewports[i].initialized = 1; |
338 | viewports[i].initialized = 1; |
339 | 339 | ||
340 | return i; |
340 | return i; |
341 | } |
341 | } |
342 | 342 | ||
343 | 343 | ||
344 | /** Initialize framebuffer as a chardev output device |
344 | /** Initialize framebuffer as a chardev output device |
345 | * |
345 | * |
346 | * @param addr Address of theframebuffer |
346 | * @param addr Address of theframebuffer |
347 | * @param x Screen width in pixels |
347 | * @param x Screen width in pixels |
348 | * @param y Screen height in pixels |
348 | * @param y Screen height in pixels |
349 | * @param bpp Bits per pixel (8, 16, 24, 32) |
349 | * @param bpp Bits per pixel (8, 16, 24, 32) |
350 | * @param scan Bytes per one scanline |
350 | * @param scan Bytes per one scanline |
351 | * |
351 | * |
352 | */ |
352 | */ |
353 | static void screen_init(__address addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan) |
353 | static void screen_init(__address addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan) |
354 | { |
354 | { |
355 | switch (bpp) { |
355 | switch (bpp) { |
356 | case 8: |
356 | case 8: |
357 | screen.putpixel = putpixel_1byte; |
357 | screen.putpixel = putpixel_1byte; |
358 | screen.getpixel = getpixel_1byte; |
358 | screen.getpixel = getpixel_1byte; |
359 | screen.pixelbytes = 1; |
359 | screen.pixelbytes = 1; |
360 | break; |
360 | break; |
361 | case 16: |
361 | case 16: |
362 | screen.putpixel = putpixel_2byte; |
362 | screen.putpixel = putpixel_2byte; |
363 | screen.getpixel = getpixel_2byte; |
363 | screen.getpixel = getpixel_2byte; |
364 | screen.pixelbytes = 2; |
364 | screen.pixelbytes = 2; |
365 | break; |
365 | break; |
366 | case 24: |
366 | case 24: |
367 | screen.putpixel = putpixel_3byte; |
367 | screen.putpixel = putpixel_3byte; |
368 | screen.getpixel = getpixel_3byte; |
368 | screen.getpixel = getpixel_3byte; |
369 | screen.pixelbytes = 3; |
369 | screen.pixelbytes = 3; |
370 | break; |
370 | break; |
371 | case 32: |
371 | case 32: |
372 | screen.putpixel = putpixel_4byte; |
372 | screen.putpixel = putpixel_4byte; |
373 | screen.getpixel = getpixel_4byte; |
373 | screen.getpixel = getpixel_4byte; |
374 | screen.pixelbytes = 4; |
374 | screen.pixelbytes = 4; |
375 | break; |
375 | break; |
376 | } |
376 | } |
377 | 377 | ||
378 | 378 | ||
379 | screen.fbaddress = (unsigned char *) addr; |
379 | screen.fbaddress = (unsigned char *) addr; |
380 | screen.xres = xres; |
380 | screen.xres = xres; |
381 | screen.yres = yres; |
381 | screen.yres = yres; |
382 | screen.scanline = scan; |
382 | screen.scanline = scan; |
383 | 383 | ||
384 | /* Create first viewport */ |
384 | /* Create first viewport */ |
385 | viewport_create(0,0,xres,yres); |
385 | viewport_create(0,0,xres,yres); |
386 | 386 | ||
387 | clear_port(0); |
387 | clear_port(0); |
388 | } |
388 | } |
389 | 389 | ||
390 | static void draw_char(int vp, char c, unsigned int row, unsigned int col) |
390 | static void draw_char(int vp, char c, unsigned int row, unsigned int col) |
391 | { |
391 | { |
392 | viewport_t *vport = &viewports[vp]; |
392 | viewport_t *vport = &viewports[vp]; |
393 | 393 | ||
394 | if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row)) |
394 | if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row)) |
395 | invert_char(vp, vport->cur_row, vport->cur_col); |
395 | invert_char(vp, vport->cur_row, vport->cur_col); |
396 | 396 | ||
397 | draw_glyph(vp, c, row, col); |
397 | draw_glyph(vp, c, row, col); |
398 | 398 | ||
399 | vport->cur_col = col; |
399 | vport->cur_col = col; |
400 | vport->cur_row = row; |
400 | vport->cur_row = row; |
401 | 401 | ||
402 | vport->cur_col++; |
402 | vport->cur_col++; |
403 | if (vport->cur_col>= vport->cols) { |
403 | if (vport->cur_col>= vport->cols) { |
404 | vport->cur_col = 0; |
404 | vport->cur_col = 0; |
405 | vport->cur_row++; |
405 | vport->cur_row++; |
406 | if (vport->cur_row >= vport->rows) |
406 | if (vport->cur_row >= vport->rows) |
407 | vport->cur_row--; |
407 | vport->cur_row--; |
408 | } |
408 | } |
409 | if (vport->cursor_active) |
409 | if (vport->cursor_active) |
410 | invert_char(vp, vport->cur_row, vport->cur_col); |
410 | invert_char(vp, vport->cur_row, vport->cur_col); |
411 | } |
411 | } |
412 | 412 | ||
413 | static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
413 | static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
414 | { |
414 | { |
415 | ipc_callid_t callid; |
415 | ipc_callid_t callid; |
416 | ipc_call_t call; |
416 | ipc_call_t call; |
417 | int retval; |
417 | int retval; |
418 | int i; |
418 | int i; |
419 | unsigned int row,col; |
419 | unsigned int row,col; |
420 | char c; |
420 | char c; |
421 | 421 | ||
422 | int vp = 0; |
422 | int vp = 0; |
423 | viewport_t *vport = &viewports[0]; |
423 | viewport_t *vport = &viewports[0]; |
424 | 424 | ||
425 | if (client_connected) { |
425 | if (client_connected) { |
426 | ipc_answer_fast(iid, ELIMIT, 0,0); |
426 | ipc_answer_fast(iid, ELIMIT, 0,0); |
427 | return; |
427 | return; |
428 | } |
428 | } |
429 | client_connected = 1; |
429 | client_connected = 1; |
430 | ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */ |
430 | ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */ |
431 | 431 | ||
432 | while (1) { |
432 | while (1) { |
433 | callid = async_get_call(&call); |
433 | callid = async_get_call(&call); |
434 | switch (IPC_GET_METHOD(call)) { |
434 | switch (IPC_GET_METHOD(call)) { |
435 | case IPC_M_PHONE_HUNGUP: |
435 | case IPC_M_PHONE_HUNGUP: |
436 | client_connected = 0; |
436 | client_connected = 0; |
437 | /* cleanup other viewports */ |
437 | /* cleanup other viewports */ |
438 | for (i=1; i < MAX_VIEWPORTS; i++) |
438 | for (i=1; i < MAX_VIEWPORTS; i++) |
439 | vport->initialized = 0; |
439 | vport->initialized = 0; |
440 | ipc_answer_fast(callid,0,0,0); |
440 | ipc_answer_fast(callid,0,0,0); |
441 | return; /* Exit thread */ |
441 | return; /* Exit thread */ |
442 | case FB_PUTCHAR: |
442 | case FB_PUTCHAR: |
443 | c = IPC_GET_ARG1(call); |
443 | c = IPC_GET_ARG1(call); |
444 | row = IPC_GET_ARG2(call); |
444 | row = IPC_GET_ARG2(call); |
445 | col = IPC_GET_ARG3(call); |
445 | col = IPC_GET_ARG3(call); |
446 | if (row >= vport->rows || col >= vport->cols) { |
446 | if (row >= vport->rows || col >= vport->cols) { |
447 | retval = EINVAL; |
447 | retval = EINVAL; |
448 | break; |
448 | break; |
449 | } |
449 | } |
450 | ipc_answer_fast(callid,0,0,0); |
450 | ipc_answer_fast(callid,0,0,0); |
451 | 451 | ||
452 | draw_char(vp, c, row, col); |
452 | draw_char(vp, c, row, col); |
453 | continue; /* msg already answered */ |
453 | continue; /* msg already answered */ |
454 | case FB_CLEAR: |
454 | case FB_CLEAR: |
455 | clear_port(vp); |
455 | clear_port(vp); |
456 | if (vport->cursor_active) |
456 | if (vport->cursor_active) |
457 | invert_char(vp, vport->cur_row, vport->cur_col); |
457 | invert_char(vp, vport->cur_row, vport->cur_col); |
458 | retval = 0; |
458 | retval = 0; |
459 | break; |
459 | break; |
460 | case FB_CURSOR_GOTO: |
460 | case FB_CURSOR_GOTO: |
461 | row = IPC_GET_ARG1(call); |
461 | row = IPC_GET_ARG1(call); |
462 | col = IPC_GET_ARG2(call); |
462 | col = IPC_GET_ARG2(call); |
463 | if (row >= vport->rows || col >= vport->cols) { |
463 | if (row >= vport->rows || col >= vport->cols) { |
464 | retval = EINVAL; |
464 | retval = EINVAL; |
465 | break; |
465 | break; |
466 | } |
466 | } |
467 | retval = 0; |
467 | retval = 0; |
468 | if (viewports[vp].cursor_active) { |
468 | if (viewports[vp].cursor_active) { |
469 | invert_char(vp, vport->cur_row, vport->cur_col); |
469 | invert_char(vp, vport->cur_row, vport->cur_col); |
470 | invert_char(vp, row, col); |
470 | invert_char(vp, row, col); |
471 | } |
471 | } |
472 | vport->cur_col = col; |
472 | vport->cur_col = col; |
473 | vport->cur_row = row; |
473 | vport->cur_row = row; |
474 | break; |
474 | break; |
475 | case FB_CURSOR_VISIBILITY: |
475 | case FB_CURSOR_VISIBILITY: |
476 | i = IPC_GET_ARG1(call); |
476 | i = IPC_GET_ARG1(call); |
477 | retval = 0; |
477 | retval = 0; |
478 | if ((i && vport->cursor_active) || (!i && !vport->cursor_active)) |
478 | if ((i && vport->cursor_active) || (!i && !vport->cursor_active)) |
479 | break; |
479 | break; |
480 | 480 | ||
481 | vport->cursor_active = i; |
481 | vport->cursor_active = i; |
482 | invert_char(vp, vport->cur_row, vport->cur_col); |
482 | invert_char(vp, vport->cur_row, vport->cur_col); |
483 | break; |
483 | break; |
484 | case FB_GET_CSIZE: |
484 | case FB_GET_CSIZE: |
485 | ipc_answer_fast(callid, 0, vport->rows, vport->cols); |
485 | ipc_answer_fast(callid, 0, vport->rows, vport->cols); |
486 | continue; |
486 | continue; |
487 | case FB_SCROLL: |
487 | case FB_SCROLL: |
488 | i = IPC_GET_ARG1(call); |
488 | i = IPC_GET_ARG1(call); |
489 | if (i > vport->rows || i < (- (int)vport->rows)) { |
489 | if (i > vport->rows || i < (- (int)vport->rows)) { |
490 | retval = EINVAL; |
490 | retval = EINVAL; |
491 | break; |
491 | break; |
492 | } |
492 | } |
493 | if (vport->cursor_active) |
493 | if (vport->cursor_active) |
494 | invert_char(vp, vport->cur_row, vport->cur_col); |
494 | invert_char(vp, vport->cur_row, vport->cur_col); |
495 | scroll_port(vp, i); |
495 | scroll_port(vp, i); |
496 | if (vport->cursor_active) |
496 | if (vport->cursor_active) |
497 | invert_char(vp, vport->cur_row, vport->cur_col); |
497 | invert_char(vp, vport->cur_row, vport->cur_col); |
498 | retval = 0; |
498 | retval = 0; |
499 | break; |
499 | break; |
500 | case FB_VIEWPORT_SWITCH: |
500 | case FB_VIEWPORT_SWITCH: |
501 | i = IPC_GET_ARG1(call); |
501 | i = IPC_GET_ARG1(call); |
502 | if (i < 0 || i >= MAX_VIEWPORTS) { |
502 | if (i < 0 || i >= MAX_VIEWPORTS) { |
503 | retval = EINVAL; |
503 | retval = EINVAL; |
504 | break; |
504 | break; |
505 | } |
505 | } |
506 | if (! viewports[i].initialized ) { |
506 | if (! viewports[i].initialized ) { |
507 | retval = EADDRNOTAVAIL; |
507 | retval = EADDRNOTAVAIL; |
508 | break; |
508 | break; |
509 | } |
509 | } |
510 | vp = i; |
510 | vp = i; |
511 | vport = &viewports[vp]; |
511 | vport = &viewports[vp]; |
512 | retval = 0; |
512 | retval = 0; |
513 | break; |
513 | break; |
514 | case FB_VIEWPORT_CREATE: |
514 | case FB_VIEWPORT_CREATE: |
515 | retval = viewport_create(IPC_GET_ARG1(call) >> 16, |
515 | retval = viewport_create(IPC_GET_ARG1(call) >> 16, |
516 | IPC_GET_ARG1(call) & 0xffff, |
516 | IPC_GET_ARG1(call) & 0xffff, |
517 | IPC_GET_ARG2(call) >> 16, |
517 | IPC_GET_ARG2(call) >> 16, |
518 | IPC_GET_ARG2(call) & 0xffff); |
518 | IPC_GET_ARG2(call) & 0xffff); |
519 | break; |
519 | break; |
520 | case FB_VIEWPORT_DELETE: |
520 | case FB_VIEWPORT_DELETE: |
521 | i = IPC_GET_ARG1(call); |
521 | i = IPC_GET_ARG1(call); |
522 | if (i < 0 || i >= MAX_VIEWPORTS) { |
522 | if (i < 0 || i >= MAX_VIEWPORTS) { |
523 | retval = EINVAL; |
523 | retval = EINVAL; |
524 | break; |
524 | break; |
525 | } |
525 | } |
526 | if (! viewports[i].initialized ) { |
526 | if (! viewports[i].initialized ) { |
527 | retval = EADDRNOTAVAIL; |
527 | retval = EADDRNOTAVAIL; |
528 | break; |
528 | break; |
529 | } |
529 | } |
530 | viewports[i].initialized = 0; |
530 | viewports[i].initialized = 0; |
531 | retval = 0; |
531 | retval = 0; |
532 | break; |
532 | break; |
533 | case FB_SET_STYLE: |
533 | case FB_SET_STYLE: |
534 | vport->fgcolor = IPC_GET_ARG1(call); |
534 | vport->fgcolor = IPC_GET_ARG1(call); |
535 | vport->bgcolor = IPC_GET_ARG2(call); |
535 | vport->bgcolor = IPC_GET_ARG2(call); |
536 | retval = 0; |
536 | retval = 0; |
537 | break; |
537 | break; |
538 | case FB_GET_RESOLUTION: |
538 | case FB_GET_RESOLUTION: |
539 | ipc_answer_fast(callid, 0, screen.xres,screen.yres); |
539 | ipc_answer_fast(callid, 0, screen.xres,screen.yres); |
540 | continue; |
540 | continue; |
541 | default: |
541 | default: |
542 | retval = ENOENT; |
542 | retval = ENOENT; |
543 | } |
543 | } |
544 | ipc_answer_fast(callid,retval,0,0); |
544 | ipc_answer_fast(callid,retval,0,0); |
545 | } |
545 | } |
546 | } |
546 | } |
547 | 547 | ||
548 | int fb_init(void) |
548 | int fb_init(void) |
549 | { |
549 | { |
550 | __address fb_ph_addr; |
550 | __address fb_ph_addr; |
551 | unsigned int fb_width; |
551 | unsigned int fb_width; |
552 | unsigned int fb_height; |
552 | unsigned int fb_height; |
553 | unsigned int fb_bpp; |
553 | unsigned int fb_bpp; |
554 | unsigned int fb_scanline; |
554 | unsigned int fb_scanline; |
555 | __address fb_addr; |
555 | __address fb_addr; |
556 | 556 | ||
557 | async_set_client_connection(fb_client_connection); |
557 | async_set_client_connection(fb_client_connection); |
558 | 558 | ||
559 | fb_ph_addr=sysinfo_value("fb.address.physical"); |
559 | fb_ph_addr=sysinfo_value("fb.address.physical"); |
560 | fb_width=sysinfo_value("fb.width"); |
560 | fb_width=sysinfo_value("fb.width"); |
561 | fb_height=sysinfo_value("fb.height"); |
561 | fb_height=sysinfo_value("fb.height"); |
562 | fb_bpp=sysinfo_value("fb.bpp"); |
562 | fb_bpp=sysinfo_value("fb.bpp"); |
563 | fb_scanline=sysinfo_value("fb.scanline"); |
563 | fb_scanline=sysinfo_value("fb.scanline"); |
564 | 564 | ||
565 | fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE); |
565 | fb_addr=ALIGN_UP(((__address)set_maxheapsize(USER_ADDRESS_SPACE_SIZE_ARCH>>1)),PAGE_SIZE); |
566 | 566 | ||
567 | map_physmem(task_get_id(),(void *)((__address)fb_ph_addr),(void *)fb_addr, |
567 | map_physmem((void *)((__address)fb_ph_addr),(void *)fb_addr, |
568 | (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH, |
568 | (fb_scanline*fb_height+PAGE_SIZE-1)>>PAGE_WIDTH, |
569 | AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
569 | AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
570 | 570 | ||
571 | screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline); |
571 | screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline); |
572 | 572 | ||
573 | return 0; |
573 | return 0; |
574 | } |
574 | } |
575 | 575 | ||
576 | 576 |