Subversion Repositories HelenOS

Rev

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

Rev 2927 Rev 3588
Line 52... Line 52...
52
#include <ddi/irq.h>
52
#include <ddi/irq.h>
53
#include <ddi/device.h>
53
#include <ddi/device.h>
54
#include <arch/drivers/ega.h>
54
#include <arch/drivers/ega.h>
55
#include <arch/bootinfo.h>
55
#include <arch/bootinfo.h>
56
#include <genarch/kbd/i8042.h>
56
#include <genarch/kbd/i8042.h>
-
 
57
#include <genarch/kbd/ns16550.h>
-
 
58
#include <smp/smp.h>
-
 
59
#include <smp/ipi.h>
-
 
60
#include <arch/atomic.h>
-
 
61
#include <panic.h>
-
 
62
#include <print.h>
-
 
63
 
-
 
64
/*NS16550 as a COM 1*/
-
 
65
#define NS16550_IRQ 4
-
 
66
#define NS16550_PORT 0x3f8
57
 
67
 
58
bootinfo_t *bootinfo;
68
bootinfo_t *bootinfo;
59
 
69
 
60
void arch_pre_main(void)
70
void arch_pre_main(void)
61
{
71
{
Line 100... Line 110...
100
   
110
   
101
}
111
}
102
 
112
 
103
void arch_post_mm_init(void)
113
void arch_post_mm_init(void)
104
{
114
{
-
 
115
    if(config.cpu_active==1)
-
 
116
    {
105
    irq_init(INR_COUNT, INR_COUNT);
117
        irq_init(INR_COUNT, INR_COUNT);
106
#ifdef SKI
118
#ifdef SKI
107
    ski_init_console();
119
        ski_init_console();
108
#else   
120
#else   
109
    ega_init();
121
        ega_init();
110
#endif  
122
#endif  
-
 
123
    }
111
    it_init(); 
124
    it_init(); 
112
}
125
}
113
 
126
 
114
void arch_post_cpu_init(void)
127
void arch_post_cpu_init(void)
115
{
128
{
Line 125... Line 138...
125
/** Kernel thread for polling keyboard. */
138
/** Kernel thread for polling keyboard. */
126
static void i8042_kkbdpoll(void *arg)
139
static void i8042_kkbdpoll(void *arg)
127
{
140
{
128
    while (1) {
141
    while (1) {
129
        i8042_poll();
142
        i8042_poll();
-
 
143
#ifdef CONFIG_NS16550
-
 
144
        ns16550_poll();
-
 
145
#endif
130
        thread_usleep(POLL_INTERVAL);
146
        thread_usleep(POLL_INTERVAL);
131
    }
147
    }
132
}
148
}
133
#endif
149
#endif
134
 
150
 
135
void arch_post_smp_init(void)
151
void arch_post_smp_init(void)
136
{
152
{
137
 
153
 
138
    if (config.cpu_active == 1) {
154
    {
139
        /*
155
        /*
140
         * Create thread that polls keyboard.
156
         * Create thread that polls keyboard.
141
         */
157
         */
142
#ifdef SKI
158
#ifdef SKI
143
        thread_t *t;
159
        thread_t *t;
Line 151... Line 167...
151
        devno_t kbd = device_assign_devno();
167
        devno_t kbd = device_assign_devno();
152
        devno_t mouse = device_assign_devno();
168
        devno_t mouse = device_assign_devno();
153
        /* keyboard controller */
169
        /* keyboard controller */
154
        i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE);
170
        i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE);
155
 
171
 
-
 
172
#ifdef CONFIG_NS16550
-
 
173
        ns16550_init(kbd, NS16550_IRQ, NS16550_PORT); // as a COM 1
-
 
174
#else
-
 
175
#endif
156
        thread_t *t;
176
        thread_t *t;
157
        t = thread_create(i8042_kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);
177
        t = thread_create(i8042_kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);
158
        if (!t)
178
        if (!t)
159
            panic("cannot create kkbdpoll\n");
179
            panic("cannot create kkbdpoll\n");
160
        thread_ready(t);
180
        thread_ready(t);
Line 162... Line 182...
162
#endif
182
#endif
163
 
183
 
164
    }
184
    }
165
}
185
}
166
 
186
 
-
 
187
 
167
/** Enter userspace and never return. */
188
/** Enter userspace and never return. */
168
void userspace(uspace_arg_t *kernel_uarg)
189
void userspace(uspace_arg_t *kernel_uarg)
169
{
190
{
170
    psr_t psr;
191
    psr_t psr;
171
    rsc_t rsc;
192
    rsc_t rsc;
Line 222... Line 243...
222
#endif
243
#endif
223
}
244
}
224
 
245
 
225
void arch_reboot(void)
246
void arch_reboot(void)
226
{
247
{
227
    // TODO
248
    outb(0x64,0xfe);
228
    while (1);
249
    while (1);
229
}
250
}
230
 
251
 
231
/** @}
252
/** @}
232
 */
253
 */