Subversion Repositories HelenOS

Rev

Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2071 Rev 2110
Line 43... Line 43...
43
#include <arch/asm.h>
43
#include <arch/asm.h>
44
#include <memstr.h>
44
#include <memstr.h>
45
#include <console/chardev.h>
45
#include <console/chardev.h>
46
#include <console/console.h>
46
#include <console/console.h>
47
#include <sysinfo/sysinfo.h>
47
#include <sysinfo/sysinfo.h>
48
#include <arch/simics/ega.h>
48
#include <arch/drivers/ega.h>
49
 
49
 
50
/*
50
/*
51
 * The EGA driver.
51
 * The EGA driver.
52
 * Simple and short. Function for displaying characters and "scrolling".
52
 * Simple and short. Function for displaying characters and "scrolling".
53
 */
53
 */
Line 64... Line 64...
64
};
64
};
65
 
65
 
66
 
66
 
67
void ega_init(void)
67
void ega_init(void)
68
{
68
{
69
   
-
 
70
    videoram = (uint8_t *) (VIDEORAM);
69
    videoram = (uint8_t *) (VIDEORAM);
71
 
70
 
-
 
71
    /*
-
 
72
     * Clear the screen.
-
 
73
     */
-
 
74
    _memsetw((uintptr_t) videoram, SCREEN, 0x0720);
-
 
75
 
72
    chardev_initialize("ega_out", &ega_console, &ega_ops);
76
    chardev_initialize("ega_out", &ega_console, &ega_ops);
73
    stdout = &ega_console;
77
    stdout = &ega_console;
74
   
78
   
75
    sysinfo_set_item_val("fb", NULL, true);
79
    sysinfo_set_item_val("fb", NULL, true);
76
    sysinfo_set_item_val("fb.kind", NULL, 2);
80
    sysinfo_set_item_val("fb.kind", NULL, 2);
Line 84... Line 88...
84
}
88
}
85
 
89
 
86
static void ega_display_char(char ch)
90
static void ega_display_char(char ch)
87
{
91
{
88
    videoram[ega_cursor * 2] = ch;
92
    videoram[ega_cursor * 2] = ch;
89
    videoram[ega_cursor * 2+1] = 7;
93
    videoram[ega_cursor * 2 + 1] = 7;
90
}
94
}
91
 
95
 
92
/*
96
/*
93
 * This function takes care of scrolling.
97
 * This function takes care of scrolling.
94
 */
98
 */
95
static void ega_check_cursor(void)
99
static void ega_check_cursor(void)
96
{
100
{
97
    int i;
-
 
98
    if (ega_cursor < SCREEN)
101
    if (ega_cursor < SCREEN)
99
        return;
102
        return;
100
 
103
 
101
    memcpy((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2);
104
    memcpy((void *) videoram, (void *) (videoram + ROW * 2), (SCREEN - ROW) * 2);
102
    for(i=0;i<ROW*2;i+=2)
-
 
103
    {
-
 
104
        videoram[(SCREEN-ROW)*2+i+0]=0x20;
-
 
105
        videoram[(SCREEN-ROW)*2+i+1]=0x07;
105
    _memsetw((uintptr_t) (videoram + (SCREEN - ROW) * 2), ROW, 0x0720);
106
    }
-
 
107
    ega_cursor = ega_cursor - ROW;
106
    ega_cursor = ega_cursor - ROW;
108
}
107
}
109
 
108
 
110
void ega_putchar(chardev_t *d, const char ch)
109
void ega_putchar(chardev_t *d, const char ch)
111
{
110
{
Line 134... Line 133...
134
 
133
 
135
    spinlock_unlock(&egalock);
134
    spinlock_unlock(&egalock);
136
    interrupts_restore(ipl);
135
    interrupts_restore(ipl);
137
}
136
}
138
 
137
 
139
 
-
 
140
/** @}
138
/** @}
141
 */
139
 */