/kernel/trunk/genarch/include/i8042/i8042.h |
---|
45,6 → 45,5 |
#define SC_END 0x4f |
extern void i8042_init(void); |
extern void i8042_poll(void); |
#endif |
/kernel/trunk/genarch/src/i8042/i8042.c |
---|
52,7 → 52,7 |
/* |
* 60 Write 8042 Command Byte: next data byte written to port 60h is |
* placed in 8042 command register. Format: |
* placed in 8042 command register.Format: |
* |
* |7|6|5|4|3|2|1|0|8042 Command Byte |
* | | | | | | | `---- 1=enable output register full interrupt |
74,11 → 74,6 |
#define SPECIAL '?' |
#define KEY_RELEASE 0x80 |
/** |
* These codes read from i8042 data register are silently ignored. |
*/ |
#define IGNORE_CODE 0x7f |
static void key_released(__u8 sc); |
static void key_pressed(__u8 sc); |
static char key_read(chardev_t *d); |
266,17 → 261,19 |
}; |
static void i8042_interrupt(int n, void *stack); |
static void i8042_wait(void); |
/** Initialize i8042. */ |
void i8042_init(void) |
{ |
exc_register(VECTOR_KBD, "i8042_interrupt", i8042_interrupt); |
i8042_wait(); |
while (i8042_status_read() & i8042_WAIT_MASK) { |
/* wait */ |
} |
i8042_command_write(i8042_SET_COMMAND); |
i8042_wait(); |
while (i8042_status_read() & i8042_WAIT_MASK) { |
/* wait */ |
} |
i8042_data_write(i8042_COMMAND); |
i8042_wait(); |
trap_virtual_enable_irqs(1<<IRQ_KBD); |
chardev_initialize("i8042_kbd", &kbrd, &ops); |
300,13 → 297,6 |
key_pressed(x); |
} |
/** Wait until the controller reads its data. */ |
void i8042_wait(void) { |
while (i8042_status_read() & i8042_WAIT_MASK) { |
/* wait */ |
} |
} |
/** Process release of key. |
* |
* @param sc Scancode of the key being released. |
512,31 → 502,10 |
while (!((x=i8042_status_read() & i8042_BUFFER_FULL_MASK))) |
; |
x = i8042_data_read(); |
if (x != IGNORE_CODE) { |
if (x & KEY_RELEASE) |
key_released(x ^ KEY_RELEASE); |
else |
active_read_key_pressed(x); |
} |
if (x & KEY_RELEASE) |
key_released(x ^ KEY_RELEASE); |
else |
active_read_key_pressed(x); |
} |
return ch; |
} |
/** Poll for key press and release events. |
* |
* This function can be used to implement keyboard polling. |
*/ |
void i8042_poll(void) |
{ |
__u8 x; |
while (((x = i8042_status_read() & i8042_BUFFER_FULL_MASK))) { |
x = i8042_data_read(); |
if (x != IGNORE_CODE) { |
if (x & KEY_RELEASE) |
key_released(x ^ KEY_RELEASE); |
else |
key_pressed(x); |
} |
} |
} |
/kernel/trunk/arch/sparc64/include/drivers/i8042.h |
---|
File deleted |
/kernel/trunk/arch/sparc64/include/drivers/keyboard.h |
---|
0,0 → 1,35 |
/* |
* Copyright (C) 2006 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 __sparc64_KEYBOARD_H__ |
#define __sparc64_KEYBOARD_H__ |
#define KBD_PHYS_ADDRESS 0x1fff8904000ULL |
#define KBD_VIRT_ADDRESS 0x00000d00000ULL |
#endif |
/kernel/trunk/arch/sparc64/include/console.h |
---|
30,7 → 30,6 |
#define __sparc64_CONSOLE_H__ |
extern void kofwinput(void *arg); |
extern void kkbdpoll(void *arg); |
extern void ofw_sparc64_console_init(void); |
extern void standalone_sparc64_console_init(void); |
/kernel/trunk/arch/sparc64/include/interrupt.h |
---|
34,13 → 34,6 |
#define IVT_ITEMS 15 |
#define IVT_FIRST 1 |
/* Dummy macros. */ |
#define IRQ_KBD 2 |
#define VECTOR_KBD IRQ_KBD |
#define trap_virtual_enable_irqs(x) |
#define trap_virtual_eoi() |
extern void interrupt_register(int n, const char *name, iroutine f); |
#endif |
/kernel/trunk/arch/sparc64/src/console.c |
---|
31,8 → 31,7 |
#include <typedefs.h> |
#include <genarch/fb/fb.h> |
#include <arch/drivers/fb.h> |
#include <arch/drivers/i8042.h> |
#include <genarch/i8042/i8042.h> |
#include <arch/drivers/keyboard.h> |
#include <genarch/ofw/ofw.h> |
#include <console/chardev.h> |
#include <console/console.h> |
41,8 → 40,6 |
#include <proc/thread.h> |
#include <synch/mutex.h> |
#define KEYBOARD_POLL_PAUSE 50000 /* 50ms */ |
static void ofw_sparc64_putchar(chardev_t *d, const char ch); |
static char ofw_sparc64_getchar(chardev_t *d); |
static void ofw_sparc64_suspend(chardev_t *d); |
76,7 → 73,6 |
ofw_console_active = 0; |
stdin = NULL; |
fb_init(FB_VIRT_ADDRESS, FB_X_RES, FB_Y_RES, FB_COLOR_DEPTH/8); |
i8042_init(); |
} |
/** Write one character using OpenFirmware. |
159,18 → 155,6 |
ch = '\n'; |
chardev_push_character(&ofw_sparc64_console, ch); |
} |
thread_usleep(KEYBOARD_POLL_PAUSE); |
thread_usleep(25000); |
} |
} |
/** Kernel thread for polling keyboard. |
* |
* @param arg Ignored. |
*/ |
void kkbdpoll(void *arg) |
{ |
while (1) { |
i8042_poll(); |
thread_usleep(KEYBOARD_POLL_PAUSE); |
} |
} |
/kernel/trunk/arch/sparc64/src/mm/tlb.c |
---|
42,7 → 42,7 |
#include <symtab.h> |
#include <arch/drivers/fb.h> |
#include <arch/drivers/i8042.h> |
#include <arch/drivers/keyboard.h> |
char *context_encoding[] = { |
"Primary", |
/kernel/trunk/arch/sparc64/src/sparc64.c |
---|
61,14 → 61,6 |
if (!t) |
panic("cannot create kofwinput\n"); |
thread_ready(t); |
/* |
* Create thread that polls keyboard. |
*/ |
t = thread_create(kkbdpoll, NULL, TASK, 0); |
if (!t) |
panic("cannot create kkbdpoll\n"); |
thread_ready(t); |
} |
void calibrate_delay_loop(void) |
/kernel/trunk/arch/sparc64/src/start.S |
---|
101,8 → 101,6 |
call ofw_init_memmap |
nop |
wrpr %r0, 0, %pil |
call main_bsp |
nop |
/kernel/trunk/arch/sparc64/Makefile.inc |
---|
57,16 → 57,8 |
CONFIG_ASID = y |
CONFIG_ASID_FIFO = y |
## Compile with support for framebuffer. |
# |
CONFIG_FB = y |
## Compile with support for i8042 controller. |
# |
CONFIG_I8042 = y |
ARCH_SOURCES = \ |
arch/$(ARCH)/src/cpu/cpu.c \ |
arch/$(ARCH)/src/asm.S \ |
/kernel/trunk/arch/amd64/include/drivers/i8042.h |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:special |
-* |
\ No newline at end of property |
/kernel/trunk/arch/amd64/include/i8042.h |
---|
0,0 → 1,0 |
link ../../ia32/include/i8042.h |
Property changes: |
Added: svn:special |
+* |
\ No newline at end of property |