Subversion Repositories HelenOS

Rev

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

Rev 2264 Rev 2274
Line 39... Line 39...
39
#include <console/console.h>
39
#include <console/console.h>
40
#include <sysinfo/sysinfo.h>
40
#include <sysinfo/sysinfo.h>
41
#include <print.h>
41
#include <print.h>
42
#include <ddi/device.h>
42
#include <ddi/device.h>
43
#include <mm/page.h>
43
#include <mm/page.h>
-
 
44
#include <arch/machine.h>
44
 
45
 
45
/** Address of devices. */
46
/** Address of devices. */
46
#define GXEMUL_VIDEORAM            0x10000000
47
#define GXEMUL_VIDEORAM            0x10000000
47
#define GXEMUL_KBD                 0x10000000
48
#define GXEMUL_KBD                 0x10000000
48
#define GXEMUL_RTC                 0x15000000
49
#define GXEMUL_RTC                 0x15000000
Line 76... Line 77...
76
    .read = gxemul_do_read,
77
    .read = gxemul_do_read,
77
};
78
};
78
 
79
 
79
 
80
 
80
/** Initializes #gxemul_hw_map. */
81
/** Initializes #gxemul_hw_map. */
81
void gxemul_hw_map_init(void)
82
void machine_hw_map_init(void)
82
{
83
{
83
    gxemul_hw_map.videoram = hw_map(GXEMUL_VIDEORAM, PAGE_SIZE);
84
    gxemul_hw_map.videoram = hw_map(GXEMUL_VIDEORAM, PAGE_SIZE);
84
    gxemul_hw_map.kbd = hw_map(GXEMUL_KBD, PAGE_SIZE);
85
    gxemul_hw_map.kbd = hw_map(GXEMUL_KBD, PAGE_SIZE);
85
    gxemul_hw_map.rtc = hw_map(GXEMUL_RTC, PAGE_SIZE);
86
    gxemul_hw_map.rtc = hw_map(GXEMUL_RTC, PAGE_SIZE);
86
    gxemul_hw_map.irqc = hw_map(GXEMUL_IRQC, PAGE_SIZE);
87
    gxemul_hw_map.irqc = hw_map(GXEMUL_IRQC, PAGE_SIZE);
Line 150... Line 151...
150
static irq_ownership_t gxemul_claim(void)
151
static irq_ownership_t gxemul_claim(void)
151
{
152
{
152
    return IRQ_ACCEPT;
153
    return IRQ_ACCEPT;
153
}
154
}
154
 
155
 
155
void gxemul_kbd_grab(void)
156
void machine_grab_console(void)
156
{
157
{
157
    ipl_t ipl = interrupts_disable();
158
    ipl_t ipl = interrupts_disable();
158
    spinlock_lock(&gxemul_irq.lock);
159
    spinlock_lock(&gxemul_irq.lock);
159
    gxemul_irq.notif_cfg.notify = false;
160
    gxemul_irq.notif_cfg.notify = false;
160
    spinlock_unlock(&gxemul_irq.lock);
161
    spinlock_unlock(&gxemul_irq.lock);
161
    interrupts_restore(ipl);
162
    interrupts_restore(ipl);
162
}
163
}
163
 
164
 
164
void gxemul_kbd_release(void)
165
void machine_release_console(void)
165
{
166
{
166
    ipl_t ipl = interrupts_disable();
167
    ipl_t ipl = interrupts_disable();
167
    spinlock_lock(&gxemul_irq.lock);
168
    spinlock_lock(&gxemul_irq.lock);
168
    if (gxemul_irq.notif_cfg.answerbox)
169
    if (gxemul_irq.notif_cfg.answerbox)
169
        gxemul_irq.notif_cfg.notify = true;
170
        gxemul_irq.notif_cfg.notify = true;
Line 171... Line 172...
171
    interrupts_restore(ipl);
172
    interrupts_restore(ipl);
172
}
173
}
173
 
174
 
174
 
175
 
175
/** Return console object representing gxemul console */
176
/** Return console object representing gxemul console */
176
void gxemul_console(devno_t devno)
177
void machine_console_init(devno_t devno)
177
{
178
{
178
    chardev_initialize("gxemul_console", &console, &gxemul_ops);
179
    chardev_initialize("gxemul_console", &console, &gxemul_ops);
179
    stdin = &console;
180
    stdin = &console;
180
    stdout = &console;
181
    stdout = &console;
181
   
182
   
Line 278... Line 279...
278
    gxemul_timer_irq.handler = gxemul_timer_irq_handler;
279
    gxemul_timer_irq.handler = gxemul_timer_irq_handler;
279
 
280
 
280
    irq_register(&gxemul_timer_irq);
281
    irq_register(&gxemul_timer_irq);
281
}
282
}
282
 
283
 
-
 
284
void machine_timer_irq_start()
-
 
285
{
-
 
286
    gxemul_timer_irq_init();
-
 
287
    gxemul_timer_start(GXEMUL_TIMER_FREQ);
-
 
288
}
-
 
289
 
283
size_t gxemul_get_memory_size(void)
290
size_t machine_get_memory_size(void)
284
{
291
{
285
    return  *((int*)(GXEMUL_MP + GXEMUL_MP_MEMSIZE_OFFSET));
292
    return  *((int*)(GXEMUL_MP + GXEMUL_MP_MEMSIZE_OFFSET));
286
}
293
}
287
 
294
 
288
void gxemul_debug_putc(char ch) {
295
void gxemul_debug_putc(char ch) {