OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 663 to Rev 664
    Reverse comparison

Rev 663 → Rev 664

/trunk/or1ksim/sim-config.h
89,6 → 89,13
int refresh_rate; /* Number of clocks per refresh */
char filename[STR_SIZE]; /* Base file name; suffix of ####.bmp is added */
} fb;
struct {
int enabled; /* Is keyboard enabled? */
unsigned long baseaddr; /* Base address of frame buffer register */
int irq; /* Irq number of this device */
char rxfile[STR_SIZE]; /* Filename for RX */
} kbd;
 
struct {
int enabled; /* is MC enabled? */
/trunk/or1ksim/sim.cfg
536,10 → 536,10
baseaddr = <hex_value>
address of first UART register for this device
 
rx_file = "<filename>"
rxfile = "<filename>"
filename, where to read data from
 
tx_file = "<filename>"
txfile = "<filename>"
filename, where to write data to
 
irq = <value>
619,10 → 619,10
tx_channel = <value>
DMA channel used for TX
 
rx_file = "<filename>"
rxfile = "<filename>"
filename, where to read data from
 
tx_file = "<filename>"
txfile = "<filename>"
filename, where to write data to
 
vapi_id = <hex_value>
646,7 → 646,7
 
/* GPIO SECTION
 
This section configures GPIOs
This section configure GPIOs
 
ngpios = <value>
make specified number of instances, configure each
688,7 → 688,7
 
/* VGA SECTION
This section configure VGA/LCD controller
This section configures VGA/LCD controller
nvgas = <value>
number of VGA devices connected
720,12 → 720,12
 
/* FB SECTION
This section configure frame buffer
This section configures frame buffer
enabled = 0/1
whether frame buffer is enabled
bufaddr = <hex_value>
baseaddr = <hex_value>
base address of frame buffer
paladdr = <hex_value>
744,3 → 744,24
refresh_rate = 100000
filename = "primary"
end
 
/* KBD SECTION
 
This section configures PS/2 compatible keyboard
enabled = 0/1
whether keyboard is enabled
baseaddr = <hex_value>
base address of the keyboard device
rxfile = "<filename>"
filename, where to read data from
*/
 
section kbd
enabled = 1
irq = 21
baseaddr = 0xb1000000
rxfile = "/tmp/kbd.rx"
end
/trunk/or1ksim/testbench/Makefile.in
92,7 → 92,7
TESTS_ENV = @TESTS_ENV@
VERSION = @VERSION@
 
OR1K_TESTS = basic cache cfg dmatest eth mmu except_test int_test flag fbtest
OR1K_TESTS = basic cache cfg dmatest eth mmu except_test int_test flag fbtest kbdtest
IND_TESTS = exit cbasic local_global mul mycompress dhry functest mem_test
# inst_set_test
ACV_TESTS = acv_uart acv_gpio
179,6 → 179,9
@OR1K_EXCEPT_TRUE@fbtest_SOURCES = $(OR1K_SUPPORT_S) support.h fbtest.c
@OR1K_EXCEPT_FALSE@fbtest_SOURCES =
@OR1K_EXCEPT_TRUE@fbtest_LDFLAGS = -T$(OR1K_SRCDIR)/default.ld
@OR1K_EXCEPT_TRUE@kbdtest_SOURCES = $(OR1K_SUPPORT_S) support.h kbdtest.c
@OR1K_EXCEPT_FALSE@kbdtest_SOURCES =
@OR1K_EXCEPT_TRUE@kbdtest_LDFLAGS = -T$(OR1K_SRCDIR)/default.ld
@OR1K_EXCEPT_TRUE@SUBDIRS = support $(SUB_TESTS) $(OR1K_SUB_TESTS)
@OR1K_EXCEPT_FALSE@SUBDIRS = support $(SUB_TESTS)
@OR1K_EXCEPT_TRUE@OR1K_SUPPORT_S = except.S
265,6 → 268,10
@OR1K_EXCEPT_FALSE@fbtest_OBJECTS =
fbtest_LDADD = $(LDADD)
fbtest_DEPENDENCIES = support/libsupport.a
@OR1K_EXCEPT_TRUE@kbdtest_OBJECTS = except.o kbdtest.o
@OR1K_EXCEPT_FALSE@kbdtest_OBJECTS =
kbdtest_LDADD = $(LDADD)
kbdtest_DEPENDENCIES = support/libsupport.a
@OR1K_EXCEPT_TRUE@acv_uart_OBJECTS = except.o acv_uart.o
@OR1K_EXCEPT_FALSE@acv_uart_OBJECTS =
acv_uart_LDADD = $(LDADD)
302,12 → 309,12
.deps/cache.P .deps/cache_asm.P .deps/cbasic.P .deps/cfg.P .deps/dhry.P \
.deps/dmatest.P .deps/eth.P .deps/except.P .deps/except_mc.P \
.deps/except_test.P .deps/except_test_s.P .deps/exit.P .deps/fbtest.P \
.deps/flag.P .deps/functest.P .deps/int_test.P .deps/local_global.P \
.deps/mc_async.P .deps/mc_common.P .deps/mc_dram.P .deps/mc_ssram.P \
.deps/mc_sync.P .deps/mem_test.P .deps/mmu.P .deps/mmu_asm.P \
.deps/mul.P .deps/mycompress.P
SOURCES = $(exit_SOURCES) $(cbasic_SOURCES) $(local_global_SOURCES) $(mul_SOURCES) $(mycompress_SOURCES) $(dhry_SOURCES) $(functest_SOURCES) $(mem_test_SOURCES) $(basic_SOURCES) $(cache_SOURCES) $(cfg_SOURCES) $(dmatest_SOURCES) $(eth_SOURCES) $(mmu_SOURCES) $(except_test_SOURCES) $(int_test_SOURCES) $(flag_SOURCES) $(fbtest_SOURCES) $(acv_uart_SOURCES) $(acv_gpio_SOURCES) $(mc_dram_SOURCES) $(mc_ssram_SOURCES) $(mc_async_SOURCES) $(mc_sync_SOURCES)
OBJECTS = $(exit_OBJECTS) $(cbasic_OBJECTS) $(local_global_OBJECTS) $(mul_OBJECTS) $(mycompress_OBJECTS) $(dhry_OBJECTS) $(functest_OBJECTS) $(mem_test_OBJECTS) $(basic_OBJECTS) $(cache_OBJECTS) $(cfg_OBJECTS) $(dmatest_OBJECTS) $(eth_OBJECTS) $(mmu_OBJECTS) $(except_test_OBJECTS) $(int_test_OBJECTS) $(flag_OBJECTS) $(fbtest_OBJECTS) $(acv_uart_OBJECTS) $(acv_gpio_OBJECTS) $(mc_dram_OBJECTS) $(mc_ssram_OBJECTS) $(mc_async_OBJECTS) $(mc_sync_OBJECTS)
.deps/flag.P .deps/functest.P .deps/int_test.P .deps/kbdtest.P \
.deps/local_global.P .deps/mc_async.P .deps/mc_common.P .deps/mc_dram.P \
.deps/mc_ssram.P .deps/mc_sync.P .deps/mem_test.P .deps/mmu.P \
.deps/mmu_asm.P .deps/mul.P .deps/mycompress.P
SOURCES = $(exit_SOURCES) $(cbasic_SOURCES) $(local_global_SOURCES) $(mul_SOURCES) $(mycompress_SOURCES) $(dhry_SOURCES) $(functest_SOURCES) $(mem_test_SOURCES) $(basic_SOURCES) $(cache_SOURCES) $(cfg_SOURCES) $(dmatest_SOURCES) $(eth_SOURCES) $(mmu_SOURCES) $(except_test_SOURCES) $(int_test_SOURCES) $(flag_SOURCES) $(fbtest_SOURCES) $(kbdtest_SOURCES) $(acv_uart_SOURCES) $(acv_gpio_SOURCES) $(mc_dram_SOURCES) $(mc_ssram_SOURCES) $(mc_async_SOURCES) $(mc_sync_SOURCES)
OBJECTS = $(exit_OBJECTS) $(cbasic_OBJECTS) $(local_global_OBJECTS) $(mul_OBJECTS) $(mycompress_OBJECTS) $(dhry_OBJECTS) $(functest_OBJECTS) $(mem_test_OBJECTS) $(basic_OBJECTS) $(cache_OBJECTS) $(cfg_OBJECTS) $(dmatest_OBJECTS) $(eth_OBJECTS) $(mmu_OBJECTS) $(except_test_OBJECTS) $(int_test_OBJECTS) $(flag_OBJECTS) $(fbtest_OBJECTS) $(kbdtest_OBJECTS) $(acv_uart_OBJECTS) $(acv_gpio_OBJECTS) $(mc_dram_OBJECTS) $(mc_ssram_OBJECTS) $(mc_async_OBJECTS) $(mc_sync_OBJECTS)
 
all: all-redirect
.SUFFIXES:
440,6 → 447,10
@rm -f fbtest
$(LINK) $(fbtest_LDFLAGS) $(fbtest_OBJECTS) $(fbtest_LDADD) $(LIBS)
 
kbdtest: $(kbdtest_OBJECTS) $(kbdtest_DEPENDENCIES)
@rm -f kbdtest
$(LINK) $(kbdtest_LDFLAGS) $(kbdtest_OBJECTS) $(kbdtest_LDADD) $(LIBS)
 
acv_uart: $(acv_uart_OBJECTS) $(acv_uart_DEPENDENCIES)
@rm -f acv_uart
$(LINK) $(acv_uart_LDFLAGS) $(acv_uart_OBJECTS) $(acv_uart_LDADD) $(LIBS)
/trunk/or1ksim/testbench/kbdtest.c
0,0 → 1,93
/* Simple keyboard test. Outputs scan codes. */
#include "support.h"
#include "spr_defs.h"
#include "support.h"
 
/* Whether this test should be run in interactive mode; scan codes are not check against real ones */
#define INTERACTIVE 0
 
#define BASEADDR 0xb1000000
 
#define KBD_INT_LINE 21 /* To which interrupt is uart connected */
 
/* fails if x is false */
#define ASSERT(x) ((x)?1: fail (__FUNCTION__, __LINE__))
/* Waits a few cycles that uart can prepare its data */
#define WAIT() {asm ("l.nop");asm ("l.nop");asm ("l.nop");asm ("l.nop");}
#define MARK() printf ("Passed line %i\n", __LINE__)
 
#ifndef __LINE__
#define __LINE__ 0
#endif
 
#if !INTERACTIVE
static const unsigned char incoming_scan[] = {
0x2a, 0x14, 0x94, 0xaa, 0x12, 0x92, 0x1f, 0x9f, 0x14, 0x94, 0x02, 0x82, 0x03, 0x83, 0x04, 0x84,
0x2a, 0x0d, 0x8d, 0xaa, 0x0b, 0x8b, 0x0d, 0x8d, 0x0c, 0x8c, 0x2a, 0x33, 0xb3, 0xaa, 0x35, 0xb5,
0x33, 0xb3, 0x2a, 0x34, 0xb4, 0xaa, 0x34, 0xb4, 0x2b, 0xab, 0x2a, 0x2b, 0xab, 0xaa, 0x2a, 0x28,
0xa8, 0xaa, 0x28, 0xa8, 0x29, 0xa9, 0x2a, 0x1b, 0x9b, 0xaa, 0x2a, 0x1a, 0x9a, 0xaa, 0x1a, 0x9a,
0x1b, 0x9b, 0x0f, 0x8f, 0x39, 0xb9, 0x1c, 0x9c, 0x2a, 0x02, 0x82, 0xaa, 0x2a, 0x03, 0x83, 0xaa,
0x2a, 0x04, 0x84, 0xaa, 0x2a, 0x05, 0x85, 0xaa, 0x2a, 0x06, 0x86, 0xaa, 0x2a, 0x07, 0x87, 0xaa,
0x2a, 0x08, 0x88, 0xaa, 0x2a, 0x09, 0x89, 0xaa, 0x2a, 0x0a, 0x8a, 0xaa, 0x2a, 0x0b, 0x8b, 0xaa,
0x1c, 0x9c, 0x2a, 0x09, 0x89, 0xaa, 0x1c, 0x9c, 0x39, 0xb9, 0x00};
static int current_scan = 0;
#endif
 
static volatile int done;
 
void fail (char *func, int line)
{
#ifndef __FUNCTION__
#define __FUNCTION__ "?"
#endif
printf ("Test failed in %s:%i\n", func, line);
report(0xeeeeeeee);
exit (1);
}
 
inline void setreg (unsigned long addr, unsigned char value)
{
*((volatile unsigned char *)addr) = value;
}
 
inline unsigned long getreg (unsigned long addr)
{
return *((volatile unsigned char *)addr);
}
 
void interrupt_handler ()
{
unsigned x;
printf ("Int\n");
do {
x = getreg (BASEADDR);
if (x) printf ("0x%02x, ", x);
report(x);
if (x == 1) done = 1;
#if !INTERACTIVE
printf ("expecting (0x%02x), ", incoming_scan[current_scan]);
ASSERT (incoming_scan[current_scan++] == x);
if (x == 0) done = 1;
#endif
} while (x);
printf ("%i", done);
mtspr(SPR_PICSR, 0);
}
 
int main ()
{
/* Use our low priority interrupt handler */
excpt_int = (unsigned long)interrupt_handler;
 
printf ("Reading from keyboard.\n");
printf ("Enabling interrupts.\n");
done = 0;
/* Enable interrupts */
mtspr (SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
mtspr (SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << KBD_INT_LINE));
 
while (!done) printf ("[%i]", done);
report (0xdeaddead);
return 0;
}
trunk/or1ksim/testbench/kbdtest.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/or1ksim/testbench/kbdtest.cfg =================================================================== --- trunk/or1ksim/testbench/kbdtest.cfg (nonexistent) +++ trunk/or1ksim/testbench/kbdtest.cfg (revision 664) @@ -0,0 +1,8 @@ +include "default.cfg" + +section kbd + enabled = 1 + irq = 21 + baseaddr = 0xb1000000 + rxfile = "./kbdtest.rx" +end
trunk/or1ksim/testbench/kbdtest.cfg Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/or1ksim/testbench/kbdtest.rx =================================================================== --- trunk/or1ksim/testbench/kbdtest.rx (nonexistent) +++ trunk/or1ksim/testbench/kbdtest.rx (revision 664) @@ -0,0 +1,4 @@ +Test123+0=-.\|"'`}{[]ª +!@#$%^&*() +* + \ No newline at end of file
trunk/or1ksim/testbench/kbdtest.rx Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/or1ksim/testbench/Makefile.am =================================================================== --- trunk/or1ksim/testbench/Makefile.am (revision 663) +++ trunk/or1ksim/testbench/Makefile.am (revision 664) @@ -21,7 +21,7 @@ ################### Tests ##################### # tests in this directory -OR1K_TESTS = basic cache cfg dmatest eth mmu except_test int_test flag fbtest +OR1K_TESTS = basic cache cfg dmatest eth mmu except_test int_test flag fbtest kbdtest IND_TESTS = exit cbasic local_global mul mycompress dhry functest mem_test # inst_set_test ACV_TESTS = acv_uart acv_gpio @@ -98,6 +98,8 @@ int_test_LDFLAGS = -T$(OR1K_SRCDIR)/xess.ld fbtest_SOURCES = $(OR1K_SUPPORT_S) support.h fbtest.c fbtest_LDFLAGS = -T$(OR1K_SRCDIR)/default.ld +kbdtest_SOURCES = $(OR1K_SUPPORT_S) support.h kbdtest.c +kbdtest_LDFLAGS = -T$(OR1K_SRCDIR)/default.ld ################################################ else @@ -115,6 +117,7 @@ except_test_SOURCES = int_test_SOURCES = fbtest_SOURCES = +kbdtest_SOURCES = ############################################### endif
/trunk/or1ksim/peripheral/Makefile.in
105,7 → 105,7
host_os = @host_os@
 
noinst_LIBRARIES = libperipheral.a
libperipheral_a_SOURCES = 16450.c dma.c mc.c ethernet.c crc32.c gpio.c vga.c fb.c
libperipheral_a_SOURCES = 16450.c dma.c mc.c ethernet.c crc32.c gpio.c vga.c fb.c ps2kbd.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
118,7 → 118,7
LIBS = @LIBS@
libperipheral_a_LIBADD =
libperipheral_a_OBJECTS = 16450.o dma.o mc.o ethernet.o crc32.o gpio.o \
vga.o fb.o
vga.o fb.o ps2kbd.o
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
130,7 → 130,7
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/16450.P .deps/crc32.P .deps/dma.P .deps/ethernet.P \
.deps/fb.P .deps/gpio.P .deps/mc.P .deps/vga.P
.deps/fb.P .deps/gpio.P .deps/mc.P .deps/ps2kbd.P .deps/vga.P
SOURCES = $(libperipheral_a_SOURCES)
OBJECTS = $(libperipheral_a_OBJECTS)
 
/trunk/or1ksim/peripheral/ps2kbd.c
0,0 → 1,159
/* ps2kbd.c -- Very simple (and limited) PS/2 keyboard simulation
Copyright (C) 2002 Marko Mlinar, markom@opencores.org
 
This file is part of OpenRISC 1000 Architectural Simulator.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ps2kbd.h"
#include "sim-config.h"
#include "abstract.h"
 
/* ASCII to scan code conversion table */
const static struct {
/* Whether shift must be pressed */
unsigned char shift;
/* Scan code to be generated */
unsigned char code;
} scan_table [128] = {
/* 0 - 15 */
{0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00},
{0, 0x0E}, {0, 0x0F}, {0, 0x1C}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00},
/* 16 - 31 */
{0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00},
{0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x01}, {0, 0x00}, {0, 0x00}, {0, 0x00}, {0, 0x00},
/* 32 - 47 */
{0, 0x39}, {1, 0x02}, {1, 0x28}, {1, 0x04}, {1, 0x05}, {1, 0x06}, {1, 0x08}, {0, 0x28},
{1, 0x0A}, {1, 0x0B}, {1, 0x09}, {1, 0x0D}, {0, 0x33}, {0, 0x0C}, {0, 0x34}, {0, 0x35},
/* 48 - 63 */
{0, 0x0B}, {0, 0x02}, {0, 0x03}, {0, 0x04}, {0, 0x05}, {0, 0x06}, {0, 0x07}, {0, 0x08},
{0, 0x09}, {0, 0x0A}, {1, 0x27}, {0, 0x27}, {1, 0x33}, {0, 0x0D}, {1, 0x34}, {1, 0x35},
/* 64 - 79 */
{1, 0x03}, {1, 0x1E}, {1, 0x30}, {1, 0x2E}, {1, 0x20}, {1, 0x12}, {1, 0x21}, {1, 0x22},
{1, 0x23}, {1, 0x17}, {1, 0x24}, {1, 0x25}, {1, 0x26}, {1, 0x32}, {1, 0x31}, {1, 0x18},
/* 80 - 95 */
{1, 0x19}, {1, 0x10}, {1, 0x13}, {1, 0x1F}, {1, 0x14}, {1, 0x16}, {1, 0x2F}, {1, 0x11},
{1, 0x2D}, {1, 0x15}, {1, 0x2C}, {0, 0x1A}, {0, 0x2B}, {0, 0x1B}, {1, 0x07}, {1, 0x0C},
/* 96 - 111 */
{0, 0x29}, {0, 0x1E}, {0, 0x30}, {0, 0x2E}, {0, 0x20}, {0, 0x12}, {0, 0x21}, {0, 0x22},
{0, 0x23}, {0, 0x17}, {0, 0x24}, {0, 0x25}, {0, 0x26}, {0, 0x32}, {0, 0x31}, {0, 0x18},
/* 112 - 127 */
{0, 0x19}, {0, 0x10}, {0, 0x13}, {0, 0x1F}, {0, 0x14}, {0, 0x16}, {0, 0x2F}, {0, 0x11},
{0, 0x2D}, {0, 0x15}, {0, 0x2C}, {1, 0x1A}, {1, 0x2B}, {1, 0x1B}, {1, 0x29}, {0, 0x00}
};
 
/* Temporary buffer to store incoming scan codes */
static unsigned char kbd_buf[KBD_MAX_BUF] = {0};
 
/* Number of scan codes in buffer */
static unsigned long kbd_buf_count = 0;
static unsigned long kbd_buf_head = 0;
static unsigned long kbd_buf_tail = 0;
 
/* Input stream */
static FILE *kbd_rxfs = NULL;
 
static void kbd_put (unsigned char c)
{
if (kbd_buf_count >= KBD_MAX_BUF) {
fprintf (stderr, "WARNING: Keyboard buffer overflow.\n");
} else {
kbd_buf[kbd_buf_head] = c;
kbd_buf_head = (kbd_buf_head + 1) % KBD_MAX_BUF;
kbd_buf_count++;
}
}
 
/* Decodes ascii code c into multiple scan codes, placed into buf, length is returned */
static void scan_decode (unsigned char c)
{
/* Do not handle special characters and extended ascii */
if (c >= 128 || !scan_table[c].code)
return;
/* Make shift? */
if (scan_table[c].shift) kbd_put (0x2a);
/* Make char */
kbd_put (scan_table[c].code);
/* Break char */
kbd_put (scan_table[c].code | 0x80);
/* Break shift? */
if (scan_table[c].shift) kbd_put (0xaa);
}
 
/* Write a register */
void kbd_write8 (unsigned long addr, unsigned long value)
{
int a = (addr - config.kbd.baseaddr);
switch (a) {
case KBD_CTRL: break;
case KBD_DATA: break;
default:
fprintf (stderr, "Write out of keyboard space (0x%08x)!\n", addr);
cont_run = 0;
break;
}
}
 
/* Read a register */
unsigned long kbd_read8 (unsigned long addr)
{
int a = (addr - config.kbd.baseaddr);
switch (a) {
case KBD_CTRL: return 0; break;
case KBD_DATA:
if (kbd_buf_count) {
unsigned long c = kbd_buf[kbd_buf_tail];
kbd_buf_tail = (kbd_buf_tail + 1) % KBD_MAX_BUF;
kbd_buf_count--;
return c;
}
return 0;
default:
fprintf (stderr, "Read out of keyboard space (0x%08x)!\n", addr);
cont_run = 0;
return 0;
}
}
 
/* Reset all VGAs */
void kbd_reset ()
{
if (config.kbd.enabled) {
kbd_buf_count = 0;
kbd_buf_head = 0;
kbd_buf_tail = 0;
register_memoryarea(config.kbd.baseaddr, KBD_SPACE, 1, kbd_read8, kbd_write8);
if (!(kbd_rxfs = fopen(config.kbd.rxfile, "r"))
&& !(kbd_rxfs = fopen(config.kbd.rxfile, "r+"))) {
fprintf (stderr, "WARNING: Keyboard has problems with RX file stream.\n");
}
}
}
 
/* Simulation hook. Must be called every clock cycle to simulate incomming data. */
void kbd_clock()
{
int c;
/* Check if there is something waiting, and decode it into kdb_buf */
if((c = fgetc(kbd_rxfs)) != EOF) {
scan_decode (c);
}
if (kbd_buf_count) report_interrupt(config.kbd.irq);
}
trunk/or1ksim/peripheral/ps2kbd.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/or1ksim/peripheral/Makefile.am =================================================================== --- trunk/or1ksim/peripheral/Makefile.am (revision 663) +++ trunk/or1ksim/peripheral/Makefile.am (revision 664) @@ -19,4 +19,4 @@ # noinst_LIBRARIES = libperipheral.a -libperipheral_a_SOURCES = 16450.c dma.c mc.c ethernet.c crc32.c gpio.c vga.c fb.c +libperipheral_a_SOURCES = 16450.c dma.c mc.c ethernet.c crc32.c gpio.c vga.c fb.c ps2kbd.c
/trunk/or1ksim/peripheral/ps2kbd.h
0,0 → 1,31
/* ps2kbd.h -- Very simple PS/2 keyboard simulation header file
Copyright (C) 2002 Marko Mlinar, markom@opencores.org
 
This file is part of OpenRISC 1000 Architectural Simulator.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
#ifndef _PS2KBD_H_
#define _PS2KBD_H_
 
/* Device registers */
#define KBD_CTRL 4
#define KBD_DATA 0
#define KBD_SPACE 8
 
/* Length of internal scan code fifo */
#define KBD_MAX_BUF 0x100
 
#endif /* !_PS2KBD_H_ */
trunk/or1ksim/peripheral/ps2kbd.h Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: trunk/or1ksim/toplevel.c =================================================================== --- trunk/or1ksim/toplevel.c (revision 663) +++ trunk/or1ksim/toplevel.c (revision 664) @@ -47,6 +47,7 @@ #include "dma.h" #include "vga.h" #include "fb.h" +#include "ps2kbd.h" #include "vapi.h" #include "gdbcomm.h" #include "debug_unit.h" @@ -56,7 +57,7 @@ #include "mprofiler.h" /* CVS revision number. */ -const char rcsrev[] = "$Revision: 1.74 $"; +const char rcsrev[] = "$Revision: 1.75 $"; /* Continuos run versus single step tracing switch. */ int cont_run; @@ -169,6 +170,7 @@ gpio_reset(); vga_reset (); fb_reset (); + kbd_reset (); tick_reset(); pm_reset(); pic_reset(); @@ -710,6 +712,7 @@ if (config.ngpios) gpio_clock(); if (config.nvgas) vga_clock(); if (config.fb.enabled) fb_clock(); + if (config.kbd.enabled) kbd_clock(); if (config.vapi.enabled && runtime.vapi.enabled) vapi_check(); if (config.debug.gdb_enabled) HandleServerSocket(false); /* block & check_stdin = false */ IFF(config.debug.enabled)
/trunk/or1ksim/sim-config.c
460,7 → 460,8
{"bpb", 0},
{"pm", 0},
{"vga", 0},
{"fb", 0}
{"fb", 0},
{"kbd", 0} /* 20 */
};
 
/* *INDENT-OFF* */
622,7 → 623,12
{19, "enabled", "=%i", NULL, (void *)(&config.fb.enabled), 0},
{19, "baseaddr", "=0x%x", NULL, (void *)(&config.fb.baseaddr), 0},
{19, "refresh_rate", "=%i", NULL, (void *)(&config.fb.refresh_rate), 0},
{19, "filename", "=\"%s\"", NULL, (void *)(&config.fb.filename), 0}
{19, "filename", "=\"%s\"", NULL, (void *)(&config.fb.filename), 0},
 
{20, "enabled", "=%i", NULL, (void *)(&config.kbd.enabled), 0},
{20, "baseaddr", "=0x%x", NULL, (void *)(&config.kbd.baseaddr), 0},
{20, "irq", "=%i", NULL, (void *)(&config.kbd.irq), 0},
{20, "rxfile", "=\"%s\"", NULL, (void *)(&config.kbd.rxfile), 0}
};
 
/* *INDENT-ON* */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.