Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 508 → Rev 509

/kernel/trunk/contrib/conf/msim.conf
10,3 → 10,4
add rwm init 0x00110000 64k load "init"
 
add dprinter printer 0x10000000
add dkeyboard keyboard 0x10000004 3
/kernel/trunk/arch/mips32/include/interrupt.h
31,8 → 31,12
 
#include <arch/exception.h>
 
#define TIMER_INTERRUPT 7
#define IRQ3 3
#define IRQ7 7
 
#define KEYBOARD_IRQ IRQ3
#define TIMER_IRQ IRQ7
 
extern void interrupt(struct exception_regdump *pstate);
 
#endif
/kernel/trunk/arch/mips32/include/drivers/keyboard.h
0,0 → 1,42
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __mips32_KEYBOARD_H__
#define __mips32_KEYBOARD_H__
 
#include <arch/types.h>
#include <arch/interrupt.h>
 
/** Address of 'keyboard' device. */
#define KEYBOARD_ADDRESS 0xB0000004
 
extern void keyboard_init(void);
extern void keyboard(void);
 
 
#endif
/kernel/trunk/arch/mips32/Makefile.inc
126,4 → 126,5
arch/$(ARCH)/src/mm/vm.c \
arch/$(ARCH)/src/fpu_context.c \
arch/$(ARCH)/src/fmath.c \
arch/$(ARCH)/src/drivers/arc.c
arch/$(ARCH)/src/drivers/arc.c \
arch/$(ARCH)/src/drivers/keyboard.c
/kernel/trunk/arch/mips32/src/interrupt.c
35,6 → 35,7
#include <print.h>
#include <symtab.h>
#include <arch/drivers/arc.h>
#include <arch/drivers/keyboard.h>
 
static void print_regdump(struct exception_regdump *pstate)
{
110,7 → 111,9
cp0_cause_write(cp0_cause_read() & ~(1 << 9)); /* clear SW1 interrupt */
break;
case 2: /* IRQ0 */
case 3: /* IRQ1 */
case KEYBOARD_IRQ:
keyboard();
break;
case 4: /* IRQ2 */
case 5: /* IRQ3 */
case 6: /* IRQ4 */
118,7 → 121,7
print_regdump(pstate);
panic("unhandled interrupt %d\n", i);
break;
case TIMER_INTERRUPT:
case TIMER_IRQ:
/* clear timer interrupt & set new */
cp0_compare_write(cp0_count_read() + cp0_compare_value);
clock();
/kernel/trunk/arch/mips32/src/drivers/keyboard.c
0,0 → 1,42
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <arch/drivers/keyboard.h>
#include <arch/cp0.h>
#include <putchar.h>
 
void keyboard_init(void)
{
/* unmask keyboard interrupt */
cp0_unmask_int(KEYBOARD_IRQ);
}
 
void keyboard(void)
{
putchar(*((char *) KEYBOARD_ADDRESS));
}
/kernel/trunk/arch/mips32/src/mips32.c
74,7 → 74,7
/*
* Unmask hardware clock interrupt.
*/
cp0_unmask_int(TIMER_INTERRUPT);
cp0_unmask_int(TIMER_IRQ);
 
/*
* Start hardware clock.
/kernel/trunk/arch/ia32/src/drivers/i8042.c
51,9 → 51,9
#define PRESSED_CAPSLOCK (1<<1)
#define LOCKED_CAPSLOCK (1<<0)
 
static spinlock_t keylock; /**< keylock protects keyflags and lockflags. */
static spinlock_t keylock; /**< keylock protects keyflags and lockflags. */
static volatile int keyflags; /**< Tracking of multiple keypresses. */
static volatile int lockflags; /**< Tracking of multiple lock keys keypresses. */
static volatile int lockflags; /**< Tracking of multiple keys lockings. */
 
/** Primary meaning of scancodes. */
static char sc_primary_map[] = {