Subversion Repositories HelenOS-historic

Rev

Rev 1649 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1649 Rev 1694
1
/*
1
/*
2
 * Copyright (C) 2006 Ondrej Palkovsky
2
 * Copyright (C) 2006 Ondrej Palkovsky
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @defgroup egafb EGA framebuffer
29
/** @defgroup egafb EGA framebuffer
30
 * @brief   HelenOS EGA framebuffer.
30
 * @brief   HelenOS EGA framebuffer.
31
 * @ingroup fbs
31
 * @ingroup fbs
32
 * @{
32
 * @{
33
 */
33
 */
34
/** @file
34
/** @file
35
 */
35
 */
36
 
36
 
37
 
37
 
38
#include <stdlib.h>
38
#include <stdlib.h>
39
#include <unistd.h>
39
#include <unistd.h>
40
#include <align.h>
40
#include <align.h>
41
#include <async.h>
41
#include <async.h>
42
#include <ipc/ipc.h>
42
#include <ipc/ipc.h>
43
#include <errno.h>
43
#include <errno.h>
44
#include <stdio.h>
44
#include <stdio.h>
45
#include <ddi.h>
45
#include <ddi.h>
46
#include <sysinfo.h>
46
#include <sysinfo.h>
47
#include <as.h>
47
#include <as.h>
48
#include <ipc/fb.h>
48
#include <ipc/fb.h>
49
#include <ipc/ipc.h>
49
#include <ipc/ipc.h>
50
#include <ipc/ns.h>
50
#include <ipc/ns.h>
51
#include <ipc/services.h>
51
#include <ipc/services.h>
-
 
52
#include <libarch/ddi.h>
52
 
53
 
53
#include "ega.h"
54
#include "ega.h"
54
#include "../console/screenbuffer.h"
55
#include "../console/screenbuffer.h"
55
#include "main.h"
56
#include "main.h"
56
 
57
 
57
#define MAX_SAVED_SCREENS 256
58
#define MAX_SAVED_SCREENS 256
58
typedef struct saved_screen {
59
typedef struct saved_screen {
59
    short *data;
60
    short *data;
60
} saved_screen;
61
} saved_screen;
61
 
62
 
62
saved_screen saved_screens[MAX_SAVED_SCREENS];
63
saved_screen saved_screens[MAX_SAVED_SCREENS];
63
 
64
 
64
 
65
 
65
#define EGA_IO_ADDRESS 0x3d4
66
#define EGA_IO_ADDRESS 0x3d4
66
#define EGA_IO_SIZE 2
67
#define EGA_IO_SIZE 2
67
 
68
 
68
#define NORMAL_COLOR       0x0f
69
#define NORMAL_COLOR       0x0f
69
#define INVERTED_COLOR     0xf0
70
#define INVERTED_COLOR     0xf0
70
 
71
 
71
#define EGA_STYLE(fg,bg) ((fg) > (bg) ? NORMAL_COLOR : INVERTED_COLOR)
72
#define EGA_STYLE(fg,bg) ((fg) > (bg) ? NORMAL_COLOR : INVERTED_COLOR)
72
 
73
 
73
typedef unsigned char u8;
-
 
74
typedef unsigned short u16;
-
 
75
typedef unsigned int u32;
-
 
76
 
-
 
77
 
-
 
78
/* Allow only 1 connection */
74
/* Allow only 1 connection */
79
static int client_connected = 0;
75
static int client_connected = 0;
80
 
76
 
81
static unsigned int scr_width;
77
static unsigned int scr_width;
82
static unsigned int scr_height;
78
static unsigned int scr_height;
83
static char *scr_addr;
79
static char *scr_addr;
84
 
80
 
85
static unsigned int style = NORMAL_COLOR;
81
static unsigned int style = NORMAL_COLOR;
86
 
82
 
87
static inline void outb(u16 port, u8 b)
-
 
88
{
-
 
89
    asm volatile ("outb %0, %1\n" :: "a" (b), "d" (port));
-
 
90
}
-
 
91
 
-
 
92
static inline void outw(u16 port, u16 w)
-
 
93
{
-
 
94
    asm volatile ("outw %0, %1\n" :: "a" (w), "d" (port));
-
 
95
}
-
 
96
 
-
 
97
static inline void outl(u16 port, u32 l)
-
 
98
{
-
 
99
    asm volatile ("outl %0, %1\n" :: "a" (l), "d" (port));
-
 
100
}
-
 
101
 
-
 
102
static inline u8 inb(u16 port)
-
 
103
{
-
 
104
    u8 val;
-
 
105
 
-
 
106
    asm volatile ("inb %1, %0 \n" : "=a" (val) : "d"(port));
-
 
107
    return val;
-
 
108
}
-
 
109
 
-
 
110
static inline u16 inw(u16 port)
-
 
111
{
-
 
112
    u16 val;
-
 
113
 
-
 
114
    asm volatile ("inw %1, %0 \n" : "=a" (val) : "d"(port));
-
 
115
    return val;
-
 
116
}
-
 
117
 
-
 
118
static inline u32 inl(u16 port)
-
 
119
{
-
 
120
    u32 val;
-
 
121
 
-
 
122
    asm volatile ("inl %1, %0 \n" : "=a" (val) : "d"(port));
-
 
123
    return val;
-
 
124
}
-
 
125
 
-
 
126
 
-
 
127
 
-
 
128
 
-
 
129
static void clrscr(void)
83
static void clrscr(void)
130
{
84
{
131
    int i;
85
    int i;
132
   
86
   
133
    for (i=0; i < scr_width*scr_height; i++) {
87
    for (i=0; i < scr_width*scr_height; i++) {
134
        scr_addr[i*2] = ' ';
88
        scr_addr[i*2] = ' ';
135
        scr_addr[i*2+1] = style;
89
        scr_addr[i*2+1] = style;
136
    }
90
    }
137
}
91
}
138
 
92
 
139
static void cursor_goto(unsigned int row, unsigned int col)
93
static void cursor_goto(unsigned int row, unsigned int col)
140
{
94
{
141
    int ega_cursor;
95
    int ega_cursor;
142
 
96
 
143
    ega_cursor=col+scr_width*row;
97
    ega_cursor=col+scr_width*row;
144
   
98
   
145
    outb(EGA_IO_ADDRESS    , 0xe);
99
    outb(EGA_IO_ADDRESS    , 0xe);
146
    outb(EGA_IO_ADDRESS + 1, (ega_cursor >>8) & 0xff);
100
    outb(EGA_IO_ADDRESS + 1, (ega_cursor >>8) & 0xff);
147
    outb(EGA_IO_ADDRESS    , 0xf);
101
    outb(EGA_IO_ADDRESS    , 0xf);
148
    outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff);
102
    outb(EGA_IO_ADDRESS + 1, ega_cursor & 0xff);
149
}
103
}
150
 
104
 
151
static void cursor_disable(void)
105
static void cursor_disable(void)
152
{
106
{
153
    u8 stat;
107
    uint8_t stat;
-
 
108
 
154
    outb(EGA_IO_ADDRESS , 0xa);
109
    outb(EGA_IO_ADDRESS , 0xa);
155
    stat=inb(EGA_IO_ADDRESS + 1);
110
    stat=inb(EGA_IO_ADDRESS + 1);
156
    outb(EGA_IO_ADDRESS , 0xa);
111
    outb(EGA_IO_ADDRESS , 0xa);
157
    outb(EGA_IO_ADDRESS +1 ,stat | (1<<5) );
112
    outb(EGA_IO_ADDRESS +1 ,stat | (1<<5) );
158
}
113
}
159
 
114
 
160
static void cursor_enable(void)
115
static void cursor_enable(void)
161
{
116
{
162
    u8 stat;
117
    uint8_t stat;
-
 
118
 
163
    outb(EGA_IO_ADDRESS , 0xa);
119
    outb(EGA_IO_ADDRESS , 0xa);
164
    stat=inb(EGA_IO_ADDRESS + 1);
120
    stat=inb(EGA_IO_ADDRESS + 1);
165
    outb(EGA_IO_ADDRESS , 0xa);
121
    outb(EGA_IO_ADDRESS , 0xa);
166
    outb(EGA_IO_ADDRESS +1 ,stat & (~(1<<5)) );
122
    outb(EGA_IO_ADDRESS +1 ,stat & (~(1<<5)) );
167
}
123
}
168
 
124
 
169
static void scroll(int rows)
125
static void scroll(int rows)
170
{
126
{
171
    int i;
127
    int i;
172
    if (rows > 0) {
128
    if (rows > 0) {
173
        memcpy (scr_addr,((char *)scr_addr) + rows * scr_width * 2, scr_width * scr_height * 2 - rows * scr_width * 2);
129
        memcpy (scr_addr,((char *)scr_addr) + rows * scr_width * 2, scr_width * scr_height * 2 - rows * scr_width * 2);
174
        for (i = 0; i < rows * scr_width ; i ++)
130
        for (i = 0; i < rows * scr_width ; i ++)
175
            (((short *)scr_addr) + scr_width * scr_height - rows * scr_width) [i] = ((style << 8) + ' ');
131
            (((short *)scr_addr) + scr_width * scr_height - rows * scr_width) [i] = ((style << 8) + ' ');
176
    } else if (rows < 0) {
132
    } else if (rows < 0) {
177
 
133
 
178
        memcpy (((char *)scr_addr) - rows * scr_width * 2 ,scr_addr ,scr_width * scr_height * 2 + rows * scr_width * 2);
134
        memcpy (((char *)scr_addr) - rows * scr_width * 2 ,scr_addr ,scr_width * scr_height * 2 + rows * scr_width * 2);
179
        for (i = 0; i < - rows * scr_width ; i++)
135
        for (i = 0; i < - rows * scr_width ; i++)
180
            ((short *)scr_addr) [i] = ((style << 8 ) + ' ');
136
            ((short *)scr_addr) [i] = ((style << 8 ) + ' ');
181
    }
137
    }
182
}
138
}
183
 
139
 
184
static void printchar(char c, unsigned int row, unsigned int col)
140
static void printchar(char c, unsigned int row, unsigned int col)
185
{
141
{
186
    scr_addr[(row*scr_width + col)*2] = c;
142
    scr_addr[(row*scr_width + col)*2] = c;
187
    scr_addr[(row*scr_width + col)*2+1] = style;
143
    scr_addr[(row*scr_width + col)*2+1] = style;
188
   
144
   
189
    cursor_goto(row,col+1);
145
    cursor_goto(row,col+1);
190
}
146
}
191
 
147
 
192
static void draw_text_data(keyfield_t *data)
148
static void draw_text_data(keyfield_t *data)
193
{
149
{
194
    int i;
150
    int i;
195
 
151
 
196
    for (i=0; i < scr_width*scr_height; i++) {
152
    for (i=0; i < scr_width*scr_height; i++) {
197
        scr_addr[i*2] = data[i].character;
153
        scr_addr[i*2] = data[i].character;
198
        scr_addr[i*2+1] = EGA_STYLE(data[i].style.fg_color, data[i].style.bg_color);
154
        scr_addr[i*2+1] = EGA_STYLE(data[i].style.fg_color, data[i].style.bg_color);
199
    }
155
    }
200
}
156
}
201
 
157
 
202
static int save_screen(void)
158
static int save_screen(void)
203
{
159
{
204
    int i;
160
    int i;
205
    short *mem;
161
    short *mem;
206
    for (i=0 ;( i < MAX_SAVED_SCREENS ) && (saved_screens[i].data); i++);
162
    for (i=0 ;( i < MAX_SAVED_SCREENS ) && (saved_screens[i].data); i++);
207
    if (i == MAX_SAVED_SCREENS)
163
    if (i == MAX_SAVED_SCREENS)
208
        return EINVAL;
164
        return EINVAL;
209
    if (!(saved_screens[i].data=malloc( 2 * scr_width*scr_height )))
165
    if (!(saved_screens[i].data=malloc( 2 * scr_width*scr_height )))
210
        return ENOMEM;
166
        return ENOMEM;
211
    memcpy (saved_screens[i].data ,scr_addr ,2 * scr_width * scr_height)
167
    memcpy (saved_screens[i].data ,scr_addr ,2 * scr_width * scr_height)
212
        ;
168
        ;
213
    return i;
169
    return i;
214
}
170
}
215
 
171
 
216
static int print_screen(int i)
172
static int print_screen(int i)
217
{
173
{
218
    if (saved_screens[i].data)
174
    if (saved_screens[i].data)
219
            memcpy (scr_addr,saved_screens[i].data, 2 * scr_width * scr_height);
175
            memcpy (scr_addr,saved_screens[i].data, 2 * scr_width * scr_height);
220
    else return EINVAL;
176
    else return EINVAL;
221
    return i;
177
    return i;
222
}
178
}
223
 
179
 
224
 
180
 
225
static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
181
static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
226
{
182
{
227
    int retval;
183
    int retval;
228
    ipc_callid_t callid;
184
    ipc_callid_t callid;
229
    ipc_call_t call;
185
    ipc_call_t call;
230
    char c;
186
    char c;
231
    unsigned int row, col;
187
    unsigned int row, col;
232
    int bgcolor,fgcolor;
188
    int bgcolor,fgcolor;
233
    keyfield_t *interbuf = NULL;
189
    keyfield_t *interbuf = NULL;
234
    size_t intersize = 0;
190
    size_t intersize = 0;
235
    int i;
191
    int i;
236
 
192
 
237
    if (client_connected) {
193
    if (client_connected) {
238
        ipc_answer_fast(iid, ELIMIT, 0,0);
194
        ipc_answer_fast(iid, ELIMIT, 0,0);
239
        return;
195
        return;
240
    }
196
    }
241
    client_connected = 1;
197
    client_connected = 1;
242
    ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
198
    ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
243
 
199
 
244
    while (1) {
200
    while (1) {
245
        callid = async_get_call(&call);
201
        callid = async_get_call(&call);
246
        switch (IPC_GET_METHOD(call)) {
202
        switch (IPC_GET_METHOD(call)) {
247
        case IPC_M_PHONE_HUNGUP:
203
        case IPC_M_PHONE_HUNGUP:
248
            client_connected = 0;
204
            client_connected = 0;
249
            ipc_answer_fast(callid,0,0,0);
205
            ipc_answer_fast(callid,0,0,0);
250
            return; /* Exit thread */
206
            return; /* Exit thread */
251
        case IPC_M_AS_AREA_SEND:
207
        case IPC_M_AS_AREA_SEND:
252
            /* We accept one area for data interchange */
208
            /* We accept one area for data interchange */
253
            intersize = IPC_GET_ARG2(call);
209
            intersize = IPC_GET_ARG2(call);
254
            if (intersize >= scr_width*scr_height*sizeof(*interbuf)) {
210
            if (intersize >= scr_width*scr_height*sizeof(*interbuf)) {
255
                receive_comm_area(callid,&call,(void **)&interbuf);
211
                receive_comm_area(callid,&call,(void **)&interbuf);
256
                continue;
212
                continue;
257
            }
213
            }
258
            retval = EINVAL;
214
            retval = EINVAL;
259
            break;
215
            break;
260
        case FB_DRAW_TEXT_DATA:
216
        case FB_DRAW_TEXT_DATA:
261
            if (!interbuf) {
217
            if (!interbuf) {
262
                retval = EINVAL;
218
                retval = EINVAL;
263
                break;
219
                break;
264
            }
220
            }
265
            draw_text_data(interbuf);
221
            draw_text_data(interbuf);
266
            retval = 0;
222
            retval = 0;
267
            break;
223
            break;
268
        case FB_GET_CSIZE:
224
        case FB_GET_CSIZE:
269
            ipc_answer_fast(callid, 0, scr_height, scr_width);
225
            ipc_answer_fast(callid, 0, scr_height, scr_width);
270
            continue;
226
            continue;
271
        case FB_CLEAR:
227
        case FB_CLEAR:
272
            clrscr();
228
            clrscr();
273
            retval = 0;
229
            retval = 0;
274
            break;
230
            break;
275
        case FB_PUTCHAR:
231
        case FB_PUTCHAR:
276
            c = IPC_GET_ARG1(call);
232
            c = IPC_GET_ARG1(call);
277
            row = IPC_GET_ARG2(call);
233
            row = IPC_GET_ARG2(call);
278
            col = IPC_GET_ARG3(call);
234
            col = IPC_GET_ARG3(call);
279
            if (col >= scr_width || row >= scr_height) {
235
            if (col >= scr_width || row >= scr_height) {
280
                retval = EINVAL;
236
                retval = EINVAL;
281
                break;
237
                break;
282
            }
238
            }
283
            printchar(c,row,col);
239
            printchar(c,row,col);
284
            retval = 0;
240
            retval = 0;
285
            break;
241
            break;
286
        case FB_CURSOR_GOTO:
242
        case FB_CURSOR_GOTO:
287
            row = IPC_GET_ARG1(call);
243
            row = IPC_GET_ARG1(call);
288
            col = IPC_GET_ARG2(call);
244
            col = IPC_GET_ARG2(call);
289
            if (row >= scr_height || col >= scr_width) {
245
            if (row >= scr_height || col >= scr_width) {
290
                retval = EINVAL;
246
                retval = EINVAL;
291
                break;
247
                break;
292
            }
248
            }
293
            cursor_goto(row,col);
249
            cursor_goto(row,col);
294
            retval = 0;
250
            retval = 0;
295
            break;
251
            break;
296
        case FB_SCROLL:
252
        case FB_SCROLL:
297
            i = IPC_GET_ARG1(call);
253
            i = IPC_GET_ARG1(call);
298
            if (i > scr_height || i < (- (int)scr_height)) {
254
            if (i > scr_height || i < (- (int)scr_height)) {
299
                retval = EINVAL;
255
                retval = EINVAL;
300
                break;
256
                break;
301
            }
257
            }
302
            scroll(i);
258
            scroll(i);
303
            retval = 0;
259
            retval = 0;
304
            break;
260
            break;
305
        case FB_CURSOR_VISIBILITY:
261
        case FB_CURSOR_VISIBILITY:
306
            if(IPC_GET_ARG1(call))
262
            if(IPC_GET_ARG1(call))
307
                cursor_enable();
263
                cursor_enable();
308
            else
264
            else
309
                cursor_disable();
265
                cursor_disable();
310
            retval = 0;
266
            retval = 0;
311
            break;
267
            break;
312
        case FB_SET_STYLE:
268
        case FB_SET_STYLE:
313
            fgcolor = IPC_GET_ARG1(call);
269
            fgcolor = IPC_GET_ARG1(call);
314
            bgcolor = IPC_GET_ARG2(call);
270
            bgcolor = IPC_GET_ARG2(call);
315
            style = EGA_STYLE(fgcolor, bgcolor);
271
            style = EGA_STYLE(fgcolor, bgcolor);
316
            break;
272
            break;
317
        case FB_VP_DRAW_PIXMAP:
273
        case FB_VP_DRAW_PIXMAP:
318
            i = IPC_GET_ARG2(call);
274
            i = IPC_GET_ARG2(call);
319
            retval = print_screen(i);
275
            retval = print_screen(i);
320
            break;
276
            break;
321
        case FB_VP2PIXMAP:
277
        case FB_VP2PIXMAP:
322
            retval = save_screen();
278
            retval = save_screen();
323
            break;
279
            break;
324
        case FB_DROP_PIXMAP:
280
        case FB_DROP_PIXMAP:
325
            i = IPC_GET_ARG1(call);
281
            i = IPC_GET_ARG1(call);
326
            if (i >= MAX_SAVED_SCREENS) {
282
            if (i >= MAX_SAVED_SCREENS) {
327
                retval = EINVAL;
283
                retval = EINVAL;
328
                break;
284
                break;
329
            }
285
            }
330
            if (saved_screens[i].data) {
286
            if (saved_screens[i].data) {
331
                free(saved_screens[i].data);
287
                free(saved_screens[i].data);
332
                saved_screens[i].data = NULL;
288
                saved_screens[i].data = NULL;
333
            }
289
            }
334
            break;
290
            break;
335
 
291
 
336
        default:
292
        default:
337
            retval = ENOENT;
293
            retval = ENOENT;
338
        }
294
        }
339
        ipc_answer_fast(callid,retval,0,0);
295
        ipc_answer_fast(callid,retval,0,0);
340
    }
296
    }
341
}
297
}
342
 
298
 
343
int ega_init(void)
299
int ega_init(void)
344
{
300
{
345
    void *ega_ph_addr;
301
    void *ega_ph_addr;
346
    size_t sz;
302
    size_t sz;
347
 
303
 
348
 
304
 
349
    ega_ph_addr=(void *)sysinfo_value("fb.address.physical");
305
    ega_ph_addr=(void *)sysinfo_value("fb.address.physical");
350
    scr_width=sysinfo_value("fb.width");
306
    scr_width=sysinfo_value("fb.width");
351
    scr_height=sysinfo_value("fb.height");
307
    scr_height=sysinfo_value("fb.height");
352
    iospace_enable(task_get_id(),(void *)EGA_IO_ADDRESS,2);
308
    iospace_enable(task_get_id(),(void *)EGA_IO_ADDRESS,2);
353
 
309
 
354
    sz = scr_width*scr_height*2;
310
    sz = scr_width*scr_height*2;
355
    scr_addr = as_get_mappable_page(sz);
311
    scr_addr = as_get_mappable_page(sz);
356
 
312
 
357
    map_physmem(ega_ph_addr, scr_addr, ALIGN_UP(sz,PAGE_SIZE)>>PAGE_WIDTH,
313
    map_physmem(ega_ph_addr, scr_addr, ALIGN_UP(sz,PAGE_SIZE)>>PAGE_WIDTH,
358
            AS_AREA_READ | AS_AREA_WRITE);
314
            AS_AREA_READ | AS_AREA_WRITE);
359
 
315
 
360
    async_set_client_connection(ega_client_connection);
316
    async_set_client_connection(ega_client_connection);
361
 
317
 
362
    return 0;
318
    return 0;
363
}
319
}
364
 
320
 
365
 
321
 
366
/**
322
/**
367
 * @}
323
 * @}
368
 */
324
 */
369
 
325