Creation of Cybook 2416 (actually Gen4) repository

This commit is contained in:
mlt
2009-12-18 17:10:00 +00:00
committed by godzil
commit 76f20f4d40
13791 changed files with 6812321 additions and 0 deletions

23
drivers/tc/Makefile Normal file
View File

@@ -0,0 +1,23 @@
#
# Makefile for the linux kernel.
#
# Object file lists.
obj-$(CONFIG_TC) += tc.o tc-driver.o
obj-$(CONFIG_ZS) += zs.o
obj-$(CONFIG_VT) += lk201.o lk201-map.o lk201-remap.o
$(obj)/lk201-map.o: $(obj)/lk201-map.c
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
# GENERATE_KEYMAP := 1
ifdef GENERATE_KEYMAP
$(obj)/lk201-map.c: $(obj)/%.c: $(src)/%.map
loadkeys --mktable $< > $@
endif

View File

@@ -0,0 +1,265 @@
/* Do not edit this file! It was automatically generated by */
/* loadkeys --mktable defkeymap.map > defkeymap.c */
#include <linux/types.h>
#include <linux/keyboard.h>
#include <linux/kd.h>
u_short plain_map[NR_KEYS] = {
0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf11b,
0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf060, 0xf031, 0xf032,
0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030,
0xf02d, 0xf03d, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
0xf200, 0xf200, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74,
0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201,
0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
0xf207, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a,
0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf05c, 0xf603, 0xf304, 0xf305,
0xf306, 0xf200, 0xf700, 0xf03e, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf200, 0xf601,
0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short shift_map[NR_KEYS] = {
0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf203,
0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf07e, 0xf021, 0xf040,
0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029,
0xf05f, 0xf02b, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
0xf200, 0xf200, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54,
0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201,
0xf117, 0xf20b, 0xf20a, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
0xf207, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a,
0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07c, 0xf603, 0xf304, 0xf305,
0xf306, 0xf200, 0xf700, 0xf03c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf200, 0xf601,
0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short altgr_map[NR_KEYS] = {
0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf202,
0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf040,
0xf200, 0xf024, 0xf200, 0xf200, 0xf07b, 0xf05b, 0xf05d, 0xf07d,
0xf05c, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xfb71, 0xfb77, 0xf918, 0xfb72, 0xfb74,
0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf200, 0xf07e, 0xf201,
0xf117, 0xf118, 0xf119, 0xf911, 0xf912, 0xf913, 0xf30b, 0xf702,
0xf207, 0xf914, 0xfb73, 0xf917, 0xf919, 0xfb67, 0xfb68, 0xfb6a,
0xfb6b, 0xfb6c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf90e, 0xf90f,
0xf910, 0xf200, 0xf700, 0xf200, 0xfb7a, 0xfb78, 0xf916, 0xfb76,
0xf915, 0xfb6e, 0xfb6d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
0xf600, 0xf602, 0xf90b, 0xf90c, 0xf90d, 0xf30e, 0xf200, 0xf703,
0xf200, 0xf200, 0xf200, 0xf90a, 0xf310, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short ctrl_map[NR_KEYS] = {
0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf204,
0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf81b, 0xf200, 0xf000,
0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f, 0xf200, 0xf200,
0xf01f, 0xf200, 0xf008, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014,
0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf201,
0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a,
0xf00b, 0xf00c, 0xf200, 0xf007, 0xf01c, 0xf603, 0xf304, 0xf305,
0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
0xf002, 0xf00e, 0xf00d, 0xf200, 0xf20e, 0xf07f, 0xf200, 0xf601,
0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
0xf000, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short shift_ctrl_map[NR_KEYS] = {
0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf200,
0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf000,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf01f, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014,
0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf200, 0xf200, 0xf201,
0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a,
0xf00b, 0xf00c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305,
0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
0xf200, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short alt_map[NR_KEYS] = {
0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200,
0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf01b, 0xf831, 0xf832,
0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830,
0xf82d, 0xf83d, 0xf87f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
0xf200, 0xf200, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874,
0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d,
0xf117, 0xf118, 0xf119, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf702,
0xf207, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a,
0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf85c, 0xf603, 0xf904, 0xf905,
0xf906, 0xf200, 0xf700, 0xf200, 0xf87a, 0xf878, 0xf863, 0xf876,
0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf200, 0xf210,
0xf600, 0xf211, 0xf901, 0xf902, 0xf903, 0xf30e, 0xf200, 0xf703,
0xf820, 0xf200, 0xf200, 0xf900, 0xf310, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short ctrl_alt_map[NR_KEYS] = {
0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200,
0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf114, 0xf115, 0xf20c, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814,
0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf200, 0xf200, 0xf201,
0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
0xf207, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a,
0xf80b, 0xf80c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305,
0xf306, 0xf200, 0xf700, 0xf200, 0xf81a, 0xf818, 0xf803, 0xf816,
0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
0xf200, 0xf200, 0xf200, 0xf300, 0xf20c, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
ushort *key_maps[MAX_NR_KEYMAPS] = {
plain_map, shift_map, altgr_map, 0,
ctrl_map, shift_ctrl_map, 0, 0,
alt_map, 0, 0, 0,
ctrl_alt_map, 0
};
unsigned int keymap_count = 7;
/*
* Philosophy: most people do not define more strings, but they who do
* often want quite a lot of string space. So, we statically allocate
* the default and allocate dynamically in chunks of 512 bytes.
*/
char func_buf[] = {
'\033', '[', '[', 'A', 0,
'\033', '[', '[', 'B', 0,
'\033', '[', '[', 'C', 0,
'\033', '[', '[', 'D', 0,
'\033', '[', '[', 'E', 0,
'\033', '[', '1', '7', '~', 0,
'\033', '[', '1', '8', '~', 0,
'\033', '[', '1', '9', '~', 0,
'\033', '[', '2', '0', '~', 0,
'\033', '[', '2', '1', '~', 0,
'\033', '[', '2', '3', '~', 0,
'\033', '[', '2', '4', '~', 0,
'\033', '[', '2', '5', '~', 0,
'\033', '[', '2', '6', '~', 0,
'\033', '[', '2', '8', '~', 0,
'\033', '[', '2', '9', '~', 0,
'\033', '[', '3', '1', '~', 0,
'\033', '[', '3', '2', '~', 0,
'\033', '[', '3', '3', '~', 0,
'\033', '[', '3', '4', '~', 0,
'\033', '[', '1', '~', 0,
'\033', '[', '2', '~', 0,
'\033', '[', '3', '~', 0,
'\033', '[', '4', '~', 0,
'\033', '[', '5', '~', 0,
'\033', '[', '6', '~', 0,
'\033', '[', 'M', 0,
'\033', '[', 'P', 0,
};
char *funcbufptr = func_buf;
int funcbufsize = sizeof(func_buf);
int funcbufleft = 0; /* space left */
char *func_table[MAX_NR_FUNC] = {
func_buf + 0,
func_buf + 5,
func_buf + 10,
func_buf + 15,
func_buf + 20,
func_buf + 25,
func_buf + 31,
func_buf + 37,
func_buf + 43,
func_buf + 49,
func_buf + 55,
func_buf + 61,
func_buf + 67,
func_buf + 73,
func_buf + 79,
func_buf + 85,
func_buf + 91,
func_buf + 97,
func_buf + 103,
func_buf + 109,
func_buf + 115,
func_buf + 120,
func_buf + 125,
func_buf + 130,
func_buf + 135,
func_buf + 140,
func_buf + 145,
0,
0,
func_buf + 149,
0,
};
struct kbdiacr accent_table[MAX_DIACR] = {
{'`', 'A', '<27>'}, {'`', 'a', '<27>'},
{'\'', 'A', '<27>'}, {'\'', 'a', '<27>'},
{'^', 'A', '<27>'}, {'^', 'a', '<27>'},
{'~', 'A', '<27>'}, {'~', 'a', '<27>'},
{'"', 'A', '<27>'}, {'"', 'a', '<27>'},
{'O', 'A', '<27>'}, {'o', 'a', '<27>'},
{'0', 'A', '<27>'}, {'0', 'a', '<27>'},
{'A', 'A', '<27>'}, {'a', 'a', '<27>'},
{'A', 'E', '<27>'}, {'a', 'e', '<27>'},
{',', 'C', '<27>'}, {',', 'c', '<27>'},
{'`', 'E', '<27>'}, {'`', 'e', '<27>'},
{'\'', 'E', '<27>'}, {'\'', 'e', '<27>'},
{'^', 'E', '<27>'}, {'^', 'e', '<27>'},
{'"', 'E', '<27>'}, {'"', 'e', '<27>'},
{'`', 'I', '<27>'}, {'`', 'i', '<27>'},
{'\'', 'I', '<27>'}, {'\'', 'i', '<27>'},
{'^', 'I', '<27>'}, {'^', 'i', '<27>'},
{'"', 'I', '<27>'}, {'"', 'i', '<27>'},
{'-', 'D', '<27>'}, {'-', 'd', '<27>'},
{'~', 'N', '<27>'}, {'~', 'n', '<27>'},
{'`', 'O', '<27>'}, {'`', 'o', '<27>'},
{'\'', 'O', '<27>'}, {'\'', 'o', '<27>'},
{'^', 'O', '<27>'}, {'^', 'o', '<27>'},
{'~', 'O', '<27>'}, {'~', 'o', '<27>'},
{'"', 'O', '<27>'}, {'"', 'o', '<27>'},
{'/', 'O', '<27>'}, {'/', 'o', '<27>'},
{'`', 'U', '<27>'}, {'`', 'u', '<27>'},
{'\'', 'U', '<27>'}, {'\'', 'u', '<27>'},
{'^', 'U', '<27>'}, {'^', 'u', '<27>'},
{'"', 'U', '<27>'}, {'"', 'u', '<27>'},
{'\'', 'Y', '<27>'}, {'\'', 'y', '<27>'},
{'T', 'H', '<27>'}, {'t', 'h', '<27>'},
{'s', 's', '<27>'}, {'"', 'y', '<27>'},
{'s', 'z', '<27>'}, {'i', 'j', '<27>'},
};
unsigned int accent_table_size = 68;

356
drivers/tc/lk201-map.map Normal file
View File

@@ -0,0 +1,356 @@
# Default kernel keymap. This uses 7 modifier combinations.
keymaps 0-2,4-5,8,12
# Change the above line into
# keymaps 0-2,4-6,8,12
# in case you want the entries
# altgr control keycode 83 = Boot
# altgr control keycode 111 = Boot
# below.
#
# In fact AltGr is used very little, and one more keymap can
# be saved by mapping AltGr to Alt (and adapting a few entries):
# keycode 100 = Alt
#
keycode 0x15 = grave tilde
alt keycode 0x15 = Escape
control keycode 0x15 = Meta_Escape
keycode 0x16 = one exclam
alt keycode 0x16 = Meta_one
keycode 0x17 = two at at
control keycode 0x17 = nul
shift control keycode 0x17 = nul
alt keycode 0x17 = Meta_two
keycode 0x18 = three numbersign
control keycode 0x18 = Escape
alt keycode 0x18 = Meta_three
keycode 0x19 = four dollar dollar
control keycode 0x19 = Control_backslash
alt keycode 0x19 = Meta_four
keycode 0x1a = five percent
control keycode 0x1a = Control_bracketright
alt keycode 0x1a = Meta_five
keycode 0x1b = six asciicircum
control keycode 0x1b = Control_asciicircum
alt keycode 0x1b = Meta_six
keycode 0x1c = seven ampersand braceleft
control keycode 0x1c = Control_underscore
alt keycode 0x1c = Meta_seven
keycode 0x1d = eight asterisk bracketleft
control keycode 0x1d = Delete
alt keycode 0x1d = Meta_eight
keycode 0x1e = nine parenleft bracketright
alt keycode 0x1e = Meta_nine
keycode 0x1f = zero parenright braceright
alt keycode 0x1f = Meta_zero
keycode 0x20 = minus underscore backslash
control keycode 0x20 = Control_underscore
shift control keycode 0x20 = Control_underscore
alt keycode 0x20 = Meta_minus
keycode 0x21 = equal plus
alt keycode 0x21 = Meta_equal
keycode 0x22 = Delete Delete
control keycode 0x22 = BackSpace
alt keycode 0x22 = Meta_Delete
keycode 0x2a = Tab Tab
alt keycode 0x2a = Meta_Tab
keycode 0x2b = q
keycode 0x2c = w
keycode 0x2d = e
altgr keycode 0x2d = Hex_E
keycode 0x2e = r
keycode 0x2f = t
keycode 0x30 = y
keycode 0x31 = u
keycode 0x32 = i
keycode 0x33 = o
keycode 0x34 = p
keycode 0x35 = bracketleft braceleft
control keycode 0x35 = Escape
alt keycode 0x35 = Meta_bracketleft
keycode 0x36 = bracketright braceright asciitilde
control keycode 0x36 = Control_bracketright
alt keycode 0x36 = Meta_bracketright
keycode 0x37 = Return
alt keycode 0x37 = Meta_Control_m
keycode 0x3f = Control
keycode 0x41 = a
altgr keycode 0x41 = Hex_A
keycode 0x42 = s
keycode 0x43 = d
altgr keycode 0x43 = Hex_D
keycode 0x44 = f
altgr keycode 0x44 = Hex_F
keycode 0x45 = g
keycode 0x46 = h
keycode 0x47 = j
keycode 0x48 = k
keycode 0x49 = l
keycode 0x4a = semicolon colon
alt keycode 0x4a = Meta_semicolon
keycode 0x4b = apostrophe quotedbl
control keycode 0x4b = Control_g
alt keycode 0x4b = Meta_apostrophe
# keycode 41 = grave asciitilde
# control keycode 41 = nul
# alt keycode 41 = Meta_grave
keycode 0x52 = Shift
keycode 0x4c = backslash bar
control keycode 0x4c = Control_backslash
alt keycode 0x4c = Meta_backslash
keycode 0x53 = greater less
keycode 0x54 = z
keycode 0x55 = x
keycode 0x56 = c
altgr keycode 0x56 = Hex_C
keycode 0x57 = v
keycode 0x58 = b
altgr keycode 0x58 = Hex_B
keycode 0x59 = n
keycode 0x5a = m
keycode 0x5b = comma less
alt keycode 0x5b = Meta_comma
keycode 0x5c = period greater
control keycode 0x5c = Compose
alt keycode 0x5c = Meta_period
keycode 0x5d = slash question
control keycode 0x5d = Delete
alt keycode 0x5d = Meta_slash
keycode 0x67 = Alt
keycode 0x68 = space space
control keycode 0x68 = nul
alt keycode 0x68 = Meta_space
keycode 0x40 = Caps_Lock
keycode 0x01 = F1
control keycode 0x01 = F1
alt keycode 0x01 = Console_1
control alt keycode 0x01 = Console_1
keycode 0x02 = F2
control keycode 0x02 = F2
alt keycode 0x02 = Console_2
control alt keycode 0x02 = Console_2
keycode 0x03 = F3
control keycode 0x03 = F3
alt keycode 0x03 = Console_3
control alt keycode 0x03 = Console_3
keycode 0x04 = F4
control keycode 0x04 = F4
alt keycode 0x04 = Console_4
control alt keycode 0x04 = Console_4
keycode 0x05 = F5
control keycode 0x05 = F5
alt keycode 0x05 = Console_5
control alt keycode 0x05 = Console_5
keycode 0x06 = F6
control keycode 0x06 = F6
alt keycode 0x06 = Console_6
control alt keycode 0x06 = Console_6
keycode 0x07 = F7
control keycode 0x07 = F7
alt keycode 0x07 = Console_7
control alt keycode 0x07 = Console_7
keycode 0x08 = F8
control keycode 0x08 = F8
alt keycode 0x08 = Console_8
control alt keycode 0x08 = Console_8
keycode 0x09 = F9
control keycode 0x09 = F9
alt keycode 0x09 = Console_9
control alt keycode 0x09 = Console_9
keycode 0x0a = F10
control keycode 0x0a = F10
alt keycode 0x0a = Console_10
control alt keycode 0x0a = Console_10
keycode 0x0b = F11
control keycode 0x0b = F11
alt keycode 0x0b = Console_11
control alt keycode 0x0b = Console_11
keycode 0x0c = F12
control keycode 0x0c = F12
alt keycode 0x0c = Console_12
control alt keycode 0x0c = Console_12
keycode 0x0d = F13
control keycode 0x0d = F13
alt keycode 0x0d = Console_13
control alt keycode 0x0d = Console_13
keycode 0x0e = F14
control keycode 0x0e = F14
alt keycode 0x0e = Console_14
control alt keycode 0x0e = Console_14
keycode 0x11 = F17
control keycode 0x11 = F17
alt keycode 0x11 = Console_17
control alt keycode 0x11 = Console_17
keycode 0x12 = F18
control keycode 0x12 = F18
alt keycode 0x12 = Console_18
control alt keycode 0x12 = Console_18
keycode 0x13 = F19
control keycode 0x13 = F19
alt keycode 0x13 = Console_19
control alt keycode 0x13 = Console_19
keycode 0x14 = F20
control keycode 0x14 = F20
alt keycode 0x14 = Console_20
control alt keycode 0x14 = Console_20
keycode 0x3b = KP_7
alt keycode 0x3b = Ascii_7
altgr keycode 0x3b = Hex_7
keycode 0x3c = KP_8
alt keycode 0x3c = Ascii_8
altgr keycode 0x3c = Hex_8
keycode 0x3d = KP_9
alt keycode 0x3d = Ascii_9
altgr keycode 0x3d = Hex_9
keycode 0x3e = KP_Subtract
keycode 0x4e = KP_4
alt keycode 0x4e = Ascii_4
altgr keycode 0x4e = Hex_4
keycode 0x4f = KP_5
alt keycode 0x4f = Ascii_5
altgr keycode 0x4f = Hex_5
keycode 0x50 = KP_6
alt keycode 0x50 = Ascii_6
altgr keycode 0x50 = Hex_6
keycode 0x62 = KP_1
alt keycode 0x62 = Ascii_1
altgr keycode 0x62 = Hex_1
keycode 0x63 = KP_2
alt keycode 0x63 = Ascii_2
altgr keycode 0x63 = Hex_2
keycode 0x64 = KP_3
alt keycode 0x64 = Ascii_3
altgr keycode 0x64 = Hex_3
keycode 0x6b = KP_0
alt keycode 0x6b = Ascii_0
altgr keycode 0x6b = Hex_0
keycode 0x6c = KP_Period
# altgr control keycode 0x6c = Boot
control alt keycode 0x6c = Boot
keycode 0x65 = KP_Enter
keycode 0x3f = Control
# keycode 100 = AltGr
keycode 0x23 = Find
keycode 0x4d = Up
keycode 0x39 = Prior
shift keycode 0x39 = Scroll_Backward
keycode 0x5f = Left
alt keycode 0x5f = Decr_Console
keycode 0x61 = Right
alt keycode 0x61 = Incr_Console
keycode 0x38 = Select
keycode 0x60 = Down
keycode 0x3a = Next
shift keycode 0x3a = Scroll_Forward
keycode 0x24 = Insert
keycode 0x25 = Remove
# altgr control keycode 0x25 = Boot
control alt keycode 0x25 = Boot
keycode 0x0f = Help Show_Memory Show_Registers
control keycode 0x0f = Show_State
keycode 0x10 = Do
string F1 = "\033[[A"
string F2 = "\033[[B"
string F3 = "\033[[C"
string F4 = "\033[[D"
string F5 = "\033[[E"
string F6 = "\033[17~"
string F7 = "\033[18~"
string F8 = "\033[19~"
string F9 = "\033[20~"
string F10 = "\033[21~"
string F11 = "\033[23~"
string F12 = "\033[24~"
string F13 = "\033[25~"
string F14 = "\033[26~"
string F15 = "\033[28~"
string F16 = "\033[29~"
string F17 = "\033[31~"
string F18 = "\033[32~"
string F19 = "\033[33~"
string F20 = "\033[34~"
string Find = "\033[1~"
string Insert = "\033[2~"
string Remove = "\033[3~"
string Select = "\033[4~"
string Prior = "\033[5~"
string Next = "\033[6~"
string Macro = "\033[M"
string Pause = "\033[P"
compose '`' 'A' to '<27>'
compose '`' 'a' to '<27>'
compose '\'' 'A' to '<27>'
compose '\'' 'a' to '<27>'
compose '^' 'A' to '<27>'
compose '^' 'a' to '<27>'
compose '~' 'A' to '<27>'
compose '~' 'a' to '<27>'
compose '"' 'A' to '<27>'
compose '"' 'a' to '<27>'
compose 'O' 'A' to '<27>'
compose 'o' 'a' to '<27>'
compose '0' 'A' to '<27>'
compose '0' 'a' to '<27>'
compose 'A' 'A' to '<27>'
compose 'a' 'a' to '<27>'
compose 'A' 'E' to '<27>'
compose 'a' 'e' to '<27>'
compose ',' 'C' to '<27>'
compose ',' 'c' to '<27>'
compose '`' 'E' to '<27>'
compose '`' 'e' to '<27>'
compose '\'' 'E' to '<27>'
compose '\'' 'e' to '<27>'
compose '^' 'E' to '<27>'
compose '^' 'e' to '<27>'
compose '"' 'E' to '<27>'
compose '"' 'e' to '<27>'
compose '`' 'I' to '<27>'
compose '`' 'i' to '<27>'
compose '\'' 'I' to '<27>'
compose '\'' 'i' to '<27>'
compose '^' 'I' to '<27>'
compose '^' 'i' to '<27>'
compose '"' 'I' to '<27>'
compose '"' 'i' to '<27>'
compose '-' 'D' to '<27>'
compose '-' 'd' to '<27>'
compose '~' 'N' to '<27>'
compose '~' 'n' to '<27>'
compose '`' 'O' to '<27>'
compose '`' 'o' to '<27>'
compose '\'' 'O' to '<27>'
compose '\'' 'o' to '<27>'
compose '^' 'O' to '<27>'
compose '^' 'o' to '<27>'
compose '~' 'O' to '<27>'
compose '~' 'o' to '<27>'
compose '"' 'O' to '<27>'
compose '"' 'o' to '<27>'
compose '/' 'O' to '<27>'
compose '/' 'o' to '<27>'
compose '`' 'U' to '<27>'
compose '`' 'u' to '<27>'
compose '\'' 'U' to '<27>'
compose '\'' 'u' to '<27>'
compose '^' 'U' to '<27>'
compose '^' 'u' to '<27>'
compose '"' 'U' to '<27>'
compose '"' 'u' to '<27>'
compose '\'' 'Y' to '<27>'
compose '\'' 'y' to '<27>'
compose 'T' 'H' to '<27>'
compose 't' 'h' to '<27>'
compose 's' 's' to '<27>'
compose '"' 'y' to '<27>'
compose 's' 'z' to '<27>'
compose 'i' 'j' to '<27>'

172
drivers/tc/lk201-remap.c Normal file
View File

@@ -0,0 +1,172 @@
/*
* Keyboard mappings for DEC LK201/401/501 keyboards
*
* 17.05.99 Michael Engel (engel@unix-ag.org)
*
* DEC US keyboards generate keycodes in the range 0x55 - 0xfb
*
* This conflicts with Linux scancode conventions which define
* 0x00-0x7f as "normal" and 0x80-0xff as "shifted" scancodes, so we
* have to remap the keycodes to 0x00-0x7f with the scancodeRemap
* array. The generated scancode is simply the number of the key counted
* from the left upper to the right lower corner of the keyboard ...
*
* These scancodes are then being remapped (I hope ;-)) with the
* lk501*map[] arrays which define scancode -> Linux code mapping
*
* Oh man is this horrible ;-)
*
* Scancodes with dual labels exist for keyboards as follows:
*
* code: left label / right label
*
* 0x73: LKx01, LK421 / LK443, LK444
* 0x74: LKx01, LK421 / LK443, LK444
* 0x7c: LKx01, LK421 / LK443, LK444
* 0x8a: LKx01, LK421 / LK443, LK444
* 0x8b: LKx01, LK421 / LK443, LK444
* 0x8c: LKx01, LK421 / LK443, LK444
* 0x8d: LKx01, LK421 / LK443, LK444
* 0x8e: LKx01, LK421 / LK443, LK444
* 0x8f: LKx01, LK421 / LK443, LK444
* 0x9c: LKx01, LK421 / LK443, LK444
* 0xa1: LKx01, LK421 / LK443, LK444
* 0xa2: LKx01, LK421 / LK443, LK444
* 0xa3: LKx01, LK421 / LK443, LK444
* 0xa4: LKx01, LK421 / LK443, LK444
* 0xad: LK421 / LK443, LK444
* 0xc9: LKx01, LK421, LK443 / LK444
* 0xf7: LKx01, LK443 / LK444
*/
unsigned char scancodeRemap[256] = {
/* ----- */
/* 0 */ 0, 0, 0, 0,
/* ----- */
/* 4 */ 0, 0, 0, 0,
/* ----- */
/* 8 */ 0, 0, 0, 0,
/* ----- */
/* c */ 0, 0, 0, 0,
/* ----- */
/* 10 */ 0, 0, 0, 0,
/* ----- */
/* 14 */ 0, 0, 0, 0,
/* ----- */
/* 18 */ 0, 0, 0, 0,
/* ----- */
/* 1c */ 0, 0, 0, 0,
/* ----- */
/* 20 */ 0, 0, 0, 0,
/* ----- */
/* 24 */ 0, 0, 0, 0,
/* ----- */
/* 28 */ 0, 0, 0, 0,
/* ----- */
/* 2c */ 0, 0, 0, 0,
/* ----- */
/* 30 */ 0, 0, 0, 0,
/* ----- */
/* 34 */ 0, 0, 0, 0,
/* ----- */
/* 38 */ 0, 0, 0, 0,
/* ----- */
/* 3c */ 0, 0, 0, 0,
/* ----- */
/* 40 */ 0, 0, 0, 0,
/* ----- */
/* 44 */ 0, 0, 0, 0,
/* ----- */
/* 48 */ 0, 0, 0, 0,
/* ----- */
/* 4c */ 0, 0, 0, 0,
/* ----- */
/* 50 */ 0, 0, 0, 0,
/* ----- ESC F1 F2 */
/* 54 */ 0, 0, 0x01, 0x02,
/* ----- F3 F4 F5 */
/* 58 */ 0x03, 0x04, 0x05, 0,
/* ----- */
/* 5c */ 0, 0, 0, 0,
/* ----- */
/* 60 */ 0, 0, 0, 0,
/* ----- F6 F7 F8 F9 */
/* 64 */ 0x06, 0x07, 0x08, 0x09,
/* ----- F10 */
/* 68 */ 0x0a, 0, 0, 0,
/* ----- */
/* 6c */ 0, 0, 0, 0,
/* ----- F11 F12 F13/PRNT SCRN */
/* 70 */ 0, 0x0b, 0x0c, 0x0d,
/* ----- F14/SCRL LCK */
/* 74 */ 0x0e, 0, 0, 0,
/* ----- */
/* 78 */ 0, 0, 0, 0,
/* ----- HELP/PAUSE DO */
/* 7c */ 0x0f, 0x10, 0, 0,
/* ----- F17 F18 F19 F20 */
/* 80 */ 0x11, 0x12, 0x13, 0x14,
/* ----- */
/* 84 */ 0, 0, 0, 0,
/* ----- FIND/INSERT INSERT/HOME */
/* 88 */ 0, 0, 0x23, 0x24,
/* ----- REMOVE/PG UP SELECT/DELETE PREVIOUS/END NEXT/PG DN */
/* 8c */ 0x25, 0x38, 0x39, 0x3a,
/* ----- KP 0 */
/* 90 */ 0, 0, 0x6b, 0,
/* ----- KP . KP ENTER KP 1 KP 2 */
/* 94 */ 0x6c, 0x65, 0x62, 0x63,
/* ----- KP 3 KP 4 KP 5 KP 6 */
/* 98 */ 0x64, 0x4e, 0x4f, 0x50,
/* ----- KP ,/KP + KP 7 KP 8 KP 9 */
/* 9c */ 0x51, 0x3b, 0x3c, 0x3d,
/* ----- KP - KP F1/NUM LCK KP F2/KP / KP F3/KP * */
/* a0 */ 0x3e, 0x26, 0x27, 0x28,
/* ----- KP F4/KP - LEFT */
/* a4 */ 0x29, 0, 0, 0x5f,
/* ----- RIGHT DOWN UP SHIFT Rt */
/* a8 */ 0x61, 0x60, 0x4d, 0x5e,
/* ----- ALT COMP Rt/CTRL Rt SHIFT CONTROL */
/* ac */ 0, 0, 0x52, 0x3f,
/* ----- CAPS COMPOSE ALT Rt */
/* b0 */ 0x40, 0x67, 0, 0,
/* ----- */
/* b4 */ 0, 0, 0, 0,
/* ----- */
/* b8 */ 0, 0, 0, 0,
/* ----- BKSP RET TAB ` */
/* bc */ 0x22, 0x37, 0x2a, 0x15,
/* ----- 1 q a z */
/* c0 */ 0x16, 0x2b, 0x41, 0x54,
/* ----- 2 w s */
/* c4 */ 0, 0x17, 0x2c, 0x42,
/* ----- x </\\ 3 */
/* c8 */ 0x55, 0x53, 0, 0x18,
/* ----- e d c */
/* cc */ 0x2d, 0x43, 0x56, 0,
/* ----- 4 r f v */
/* d0 */ 0x19, 0x2e, 0x44, 0x57,
/* ----- SPACE 5 t */
/* d4 */ 0x68, 0, 0x1a, 0x2f,
/* ----- g b 6 */
/* d8 */ 0x45, 0x58, 0, 0x1b,
/* ----- y h n */
/* dc */ 0x30, 0x46, 0x59, 0,
/* ----- 7 u j m */
/* e0 */ 0x1c, 0x31, 0x47, 0x5a,
/* ----- 8 i k */
/* e4 */ 0, 0x1d, 0x32, 0x48,
/* ----- , 9 o */
/* e8 */ 0x5b, 0, 0x1e, 0x33,
/* ----- l . 0 */
/* ec */ 0x49, 0x5c, 0, 0x1f,
/* ----- p ; / */
/* f0 */ 0x34, 0, 0x4a, 0x5d,
/* ----- = ] \\/\' */
/* f4 */ 0, 0x21, 0x36, 0x4c,
/* ----- - [ \' */
/* f8 */ 0, 0x20, 0x35, 0x4b,
/* ----- */
/* fc */ 0, 0, 0, 0,
};

439
drivers/tc/lk201.c Normal file
View File

@@ -0,0 +1,439 @@
/*
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1999-2002 Harald Koerfgen <hkoerfg@web.de>
* Copyright (C) 2001, 2002, 2003, 2004 Maciej W. Rozycki
*/
#include <linux/errno.h>
#include <linux/tty.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kbd_ll.h>
#include <linux/kbd_kern.h>
#include <linux/vt_kern.h>
#include <asm/keyboard.h>
#include <asm/dec/tc.h>
#include <asm/dec/machtype.h>
#include <asm/dec/serial.h>
#include "lk201.h"
/*
* Only handle DECstations that have an LK201 interface.
* Maxine uses LK501 at the Access.Bus and various DECsystems
* have no keyboard interface at all.
*/
#define LK_IFACE (mips_machtype == MACH_DS23100 || \
mips_machtype == MACH_DS5000_200 || \
mips_machtype == MACH_DS5000_1XX || \
mips_machtype == MACH_DS5000_2X0)
/*
* These use the Z8530 SCC. Others use the DZ11.
*/
#define LK_IFACE_ZS (mips_machtype == MACH_DS5000_1XX || \
mips_machtype == MACH_DS5000_2X0)
/* Simple translation table for the SysRq keys */
#ifdef CONFIG_MAGIC_SYSRQ
/*
* Actually no translation at all, at least until we figure out
* how to define SysRq for LK201 and friends. --macro
*/
unsigned char lk201_sysrq_xlate[128];
unsigned char *kbd_sysrq_xlate = lk201_sysrq_xlate;
unsigned char kbd_sysrq_key = -1;
#endif
#define KEYB_LINE 3
static int __init lk201_init(void *);
static void __init lk201_info(void *);
static void lk201_rx_char(unsigned char, unsigned char);
static struct dec_serial_hook lk201_hook = {
.init_channel = lk201_init,
.init_info = lk201_info,
.rx_char = NULL,
.poll_rx_char = NULL,
.poll_tx_char = NULL,
.cflags = B4800 | CS8 | CSTOPB | CLOCAL,
};
/*
* This is used during keyboard initialisation
*/
static unsigned char lk201_reset_string[] = {
LK_CMD_SET_DEFAULTS,
LK_CMD_MODE(LK_MODE_RPT_DOWN, 1),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 2),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 3),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 4),
LK_CMD_MODE(LK_MODE_DOWN_UP, 5),
LK_CMD_MODE(LK_MODE_DOWN_UP, 6),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 7),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 8),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 9),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 10),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 11),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 12),
LK_CMD_MODE(LK_MODE_DOWN, 13),
LK_CMD_MODE(LK_MODE_RPT_DOWN, 14),
LK_CMD_DIS_KEYCLK,
LK_CMD_ENB_BELL, LK_PARAM_VOLUME(4),
};
static void *lk201_handle;
static int lk201_send(unsigned char ch)
{
if (lk201_hook.poll_tx_char(lk201_handle, ch)) {
printk(KERN_ERR "lk201: transmit timeout\n");
return -EIO;
}
return 0;
}
static inline int lk201_get_id(void)
{
return lk201_send(LK_CMD_REQ_ID);
}
static int lk201_reset(void)
{
int i, r;
for (i = 0; i < sizeof(lk201_reset_string); i++) {
r = lk201_send(lk201_reset_string[i]);
if (r < 0)
return r;
}
return 0;
}
static void lk201_report(unsigned char id[6])
{
char *report = "lk201: keyboard attached, ";
switch (id[2]) {
case LK_STAT_PWRUP_OK:
printk(KERN_INFO "%sself-test OK\n", report);
break;
case LK_STAT_PWRUP_KDOWN:
/* The keyboard will resend the power-up ID
after all keys are released, so we don't
bother handling the error specially. Still
there may be a short-circuit inside.
*/
printk(KERN_ERR "%skey down (stuck?), code: 0x%02x\n",
report, id[3]);
break;
case LK_STAT_PWRUP_ERROR:
printk(KERN_ERR "%sself-test failure\n", report);
break;
default:
printk(KERN_ERR "%sunknown error: 0x%02x\n",
report, id[2]);
}
}
static void lk201_id(unsigned char id[6])
{
/*
* Report whether there is an LK201 or an LK401
* The LK401 has ALT keys...
*/
switch (id[4]) {
case 1:
printk(KERN_INFO "lk201: LK201 detected\n");
break;
case 2:
printk(KERN_INFO "lk201: LK401 detected\n");
break;
case 3:
printk(KERN_INFO "lk201: LK443 detected\n");
break;
case 4:
printk(KERN_INFO "lk201: LK421 detected\n");
break;
default:
printk(KERN_WARNING
"lk201: unknown keyboard detected, ID %d\n", id[4]);
printk(KERN_WARNING "lk201: ... please report to "
"<linux-mips@linux-mips.org>\n");
}
}
#define DEFAULT_KEYB_REP_DELAY (250/5) /* [5ms] */
#define DEFAULT_KEYB_REP_RATE 30 /* [cps] */
static struct kbd_repeat kbdrate = {
DEFAULT_KEYB_REP_DELAY,
DEFAULT_KEYB_REP_RATE
};
static void parse_kbd_rate(struct kbd_repeat *r)
{
if (r->delay <= 0)
r->delay = kbdrate.delay;
if (r->rate <= 0)
r->rate = kbdrate.rate;
if (r->delay < 5)
r->delay = 5;
if (r->delay > 630)
r->delay = 630;
if (r->rate < 12)
r->rate = 12;
if (r->rate > 127)
r->rate = 127;
if (r->rate == 125)
r->rate = 124;
}
static int write_kbd_rate(struct kbd_repeat *rep)
{
int delay, rate;
int i;
delay = rep->delay / 5;
rate = rep->rate;
for (i = 0; i < 4; i++) {
if (lk201_hook.poll_tx_char(lk201_handle,
LK_CMD_RPT_RATE(i)))
return 1;
if (lk201_hook.poll_tx_char(lk201_handle,
LK_PARAM_DELAY(delay)))
return 1;
if (lk201_hook.poll_tx_char(lk201_handle,
LK_PARAM_RATE(rate)))
return 1;
}
return 0;
}
static int lk201_kbd_rate(struct kbd_repeat *rep)
{
if (rep == NULL)
return -EINVAL;
parse_kbd_rate(rep);
if (write_kbd_rate(rep)) {
memcpy(rep, &kbdrate, sizeof(struct kbd_repeat));
return -EIO;
}
memcpy(&kbdrate, rep, sizeof(struct kbd_repeat));
return 0;
}
static void lk201_kd_mksound(unsigned int hz, unsigned int ticks)
{
if (!ticks)
return;
/*
* Can't set frequency and we "approximate"
* duration by volume. ;-)
*/
ticks /= HZ / 32;
if (ticks > 7)
ticks = 7;
ticks = 7 - ticks;
if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_ENB_BELL))
return;
if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_VOLUME(ticks)))
return;
if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_BELL))
return;
}
void kbd_leds(unsigned char leds)
{
unsigned char l = 0;
if (!lk201_handle) /* FIXME */
return;
/* FIXME -- Only Hold and Lock LEDs for now. --macro */
if (leds & LED_SCR)
l |= LK_LED_HOLD;
if (leds & LED_CAP)
l |= LK_LED_LOCK;
if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_ON))
return;
if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(l)))
return;
if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_OFF))
return;
if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(~l)))
return;
}
int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
{
return -EINVAL;
}
int kbd_getkeycode(unsigned int scancode)
{
return -EINVAL;
}
int kbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode)
{
*keycode = scancode;
return 1;
}
char kbd_unexpected_up(unsigned char keycode)
{
return 0x80;
}
static void lk201_rx_char(unsigned char ch, unsigned char fl)
{
static unsigned char id[6];
static int id_i;
static int shift_state = 0;
static int prev_scancode;
unsigned char c = scancodeRemap[ch];
if (fl != TTY_NORMAL && fl != TTY_OVERRUN) {
printk(KERN_ERR "lk201: keyboard receive error: 0x%02x\n", fl);
return;
}
/* Assume this is a power-up ID. */
if (ch == LK_STAT_PWRUP_ID && !id_i) {
id[id_i++] = ch;
return;
}
/* Handle the power-up sequence. */
if (id_i) {
id[id_i++] = ch;
if (id_i == 4) {
/* OK, the power-up concluded. */
lk201_report(id);
if (id[2] == LK_STAT_PWRUP_OK)
lk201_get_id();
else {
id_i = 0;
printk(KERN_ERR "lk201: keyboard power-up "
"error, skipping initialization\n");
}
} else if (id_i == 6) {
/* We got the ID; report it and start operation. */
id_i = 0;
lk201_id(id);
lk201_reset();
}
return;
}
/* Everything else is a scancode/status response. */
id_i = 0;
switch (ch) {
case LK_STAT_RESUME_ERR:
case LK_STAT_ERROR:
case LK_STAT_INHIBIT_ACK:
case LK_STAT_TEST_ACK:
case LK_STAT_MODE_KEYDOWN:
case LK_STAT_MODE_ACK:
break;
case LK_KEY_LOCK:
shift_state ^= LK_LOCK;
handle_scancode(c, (shift_state & LK_LOCK) ? 1 : 0);
break;
case LK_KEY_SHIFT:
shift_state ^= LK_SHIFT;
handle_scancode(c, (shift_state & LK_SHIFT) ? 1 : 0);
break;
case LK_KEY_CTRL:
shift_state ^= LK_CTRL;
handle_scancode(c, (shift_state & LK_CTRL) ? 1 : 0);
break;
case LK_KEY_COMP:
shift_state ^= LK_COMP;
handle_scancode(c, (shift_state & LK_COMP) ? 1 : 0);
break;
case LK_KEY_RELEASE:
if (shift_state & LK_SHIFT)
handle_scancode(scancodeRemap[LK_KEY_SHIFT], 0);
if (shift_state & LK_CTRL)
handle_scancode(scancodeRemap[LK_KEY_CTRL], 0);
if (shift_state & LK_COMP)
handle_scancode(scancodeRemap[LK_KEY_COMP], 0);
if (shift_state & LK_LOCK)
handle_scancode(scancodeRemap[LK_KEY_LOCK], 0);
shift_state = 0;
break;
case LK_KEY_REPEAT:
handle_scancode(prev_scancode, 1);
break;
default:
prev_scancode = c;
handle_scancode(c, 1);
break;
}
tasklet_schedule(&keyboard_tasklet);
}
static void __init lk201_info(void *handle)
{
}
static int __init lk201_init(void *handle)
{
/* First install handlers. */
lk201_handle = handle;
kbd_rate = lk201_kbd_rate;
kd_mksound = lk201_kd_mksound;
lk201_hook.rx_char = lk201_rx_char;
/* Then just issue a reset -- the handlers will do the rest. */
lk201_send(LK_CMD_POWER_UP);
return 0;
}
void __init kbd_init_hw(void)
{
/* Maxine uses LK501 at the Access.Bus. */
if (!LK_IFACE)
return;
printk(KERN_INFO "lk201: DECstation LK keyboard driver v0.05.\n");
if (LK_IFACE_ZS) {
/*
* kbd_init_hw() is being called before
* rs_init() so just register the kbd hook
* and let zs_init do the rest :-)
*/
if (!register_dec_serial_hook(KEYB_LINE, &lk201_hook))
unregister_dec_serial_hook(KEYB_LINE);
} else {
/*
* TODO: modify dz.c to allow similar hooks
* for LK201 handling on DS2100, DS3100, and DS5000/200
*/
printk(KERN_ERR "lk201: support for DZ11 not yet ready.\n");
}
}

125
drivers/tc/lk201.h Normal file
View File

@@ -0,0 +1,125 @@
/*
* Commands to the keyboard processor
*/
#define LK_PARAM 0x80 /* start/end parameter list */
#define LK_CMD_RESUME 0x8b /* resume transmission to the host */
#define LK_CMD_INHIBIT 0x89 /* stop transmission to the host */
#define LK_CMD_LEDS_ON 0x13 /* light LEDs */
/* 1st param: led bitmask */
#define LK_CMD_LEDS_OFF 0x11 /* turn off LEDs */
/* 1st param: led bitmask */
#define LK_CMD_DIS_KEYCLK 0x99 /* disable the keyclick */
#define LK_CMD_ENB_KEYCLK 0x1b /* enable the keyclick */
/* 1st param: volume */
#define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */
#define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */
#define LK_CMD_SOUND_CLK 0x9f /* emit a keyclick */
#define LK_CMD_DIS_BELL 0xa1 /* disable the bell */
#define LK_CMD_ENB_BELL 0x23 /* enable the bell */
/* 1st param: volume */
#define LK_CMD_BELL 0xa7 /* emit a bell */
#define LK_CMD_TMP_NORPT 0xd1 /* disable typematic */
/* for the currently pressed key */
#define LK_CMD_ENB_RPT 0xe3 /* enable typematic */
/* for RPT_DOWN groups */
#define LK_CMD_DIS_RPT 0xe1 /* disable typematic */
/* for RPT_DOWN groups */
#define LK_CMD_RPT_TO_DOWN 0xd9 /* set RPT_DOWN groups to DOWN */
#define LK_CMD_REQ_ID 0xab /* request the keyboard ID */
#define LK_CMD_POWER_UP 0xfd /* init power-up sequence */
#define LK_CMD_TEST_MODE 0xcb /* enter the factory test mode */
#define LK_CMD_TEST_EXIT 0x80 /* exit the factory test mode */
#define LK_CMD_SET_DEFAULTS 0xd3 /* set power-up defaults */
#define LK_CMD_MODE(m,div) (LK_PARAM|(((div)&0xf)<<3)|(((m)&0x3)<<1))
/* select the repeat mode */
/* for the selected key group */
#define LK_CMD_MODE_AR(m,div) ((((div)&0xf)<<3)|(((m)&0x3)<<1))
/* select the repeat mode */
/* and the repeat register */
/* for the selected key group */
/* 1st param: register number */
#define LK_CMD_RPT_RATE(r) (0x78|(((r)&0x3)<<1))
/* set the delay and repeat rate */
/* for the selected repeat register */
/* 1st param: initial delay */
/* 2nd param: repeat rate */
/* there are 4 leds, represent them in the low 4 bits of a byte */
#define LK_PARAM_LED_MASK(ledbmap) (LK_PARAM|((ledbmap)&0xf))
#define LK_LED_WAIT 0x1 /* Wait LED */
#define LK_LED_COMP 0x2 /* Compose LED */
#define LK_LED_LOCK 0x4 /* Lock LED */
#define LK_LED_HOLD 0x8 /* Hold Screen LED */
/* max volume is 0, lowest is 0x7 */
#define LK_PARAM_VOLUME(v) (LK_PARAM|((v)&0x7))
/* mode set command details, div is a key group number */
#define LK_MODE_DOWN 0x0 /* make only */
#define LK_MODE_RPT_DOWN 0x1 /* make and typematic */
#define LK_MODE_DOWN_UP 0x3 /* make and release */
/* there are 4 repeat registers */
#define LK_PARAM_AR(r) (LK_PARAM|((v)&0x3))
/*
* Mappings between key groups and keycodes are as follows:
*
* 1: 0xbf - 0xff -- alphanumeric,
* 2: 0x91 - 0xa5 -- numeric keypad,
* 3: 0xbc -- Backspace,
* 4: 0xbd - 0xbe -- Tab, Return,
* 5: 0xb0 - 0xb2 -- Lock, Compose Character,
* 6: 0xad - 0xaf -- Ctrl, Shift,
* 7: 0xa6 - 0xa8 -- Left Arrow, Right Arrow,
* 8: 0xa9 - 0xac -- Up Arrow, Down Arrow, Right Shift,
* 9: 0x88 - 0x90 -- editor keypad,
* 10: 0x56 - 0x62 -- F1 - F5,
* 11: 0x63 - 0x6e -- F6 - F10,
* 12: 0x6f - 0x7a -- F11 - F14,
* 13: 0x7b - 0x7d -- Help, Do,
* 14: 0x7e - 0x87 -- F17 - F20.
*
* Notes:
* 1. Codes in the 0x00 - 0x40 range are reserved.
* 2. The assignment of the 0x41 - 0x55 range is undiscovered, probably 10.
*/
/* delay is 5 - 630 ms; 0x00 and 0x7f are reserved */
#define LK_PARAM_DELAY(t) ((t)&0x7f)
/* rate is 12 - 127 Hz; 0x00 - 0x0b and 0x7d (power-up!) are reserved */
#define LK_PARAM_RATE(r) (LK_PARAM|((r)&0x7f))
#define LK_SHIFT 1<<0
#define LK_CTRL 1<<1
#define LK_LOCK 1<<2
#define LK_COMP 1<<3
#define LK_KEY_SHIFT 0xae
#define LK_KEY_CTRL 0xaf
#define LK_KEY_LOCK 0xb0
#define LK_KEY_COMP 0xb1
#define LK_KEY_RELEASE 0xb3 /* all keys released */
#define LK_KEY_REPEAT 0xb4 /* repeat the last key */
/* status responses */
#define LK_STAT_RESUME_ERR 0xb5 /* keystrokes lost while inhibited */
#define LK_STAT_ERROR 0xb6 /* an invalid command received */
#define LK_STAT_INHIBIT_ACK 0xb7 /* transmission inhibited */
#define LK_STAT_TEST_ACK 0xb8 /* the factory test mode entered */
#define LK_STAT_MODE_KEYDOWN 0xb9 /* a key is down on a change */
/* to the DOWN_UP mode; */
/* the keycode follows */
#define LK_STAT_MODE_ACK 0xba /* the mode command succeeded */
#define LK_STAT_PWRUP_ID 0x01 /* the power-up response start mark */
#define LK_STAT_PWRUP_OK 0x00 /* the power-up self test OK */
#define LK_STAT_PWRUP_KDOWN 0x3d /* a key was down during the test */
#define LK_STAT_PWRUP_ERROR 0x3e /* keyboard self test failure */
extern unsigned char scancodeRemap[256];

110
drivers/tc/tc-driver.c Normal file
View File

@@ -0,0 +1,110 @@
/*
* TURBOchannel driver services.
*
* Copyright (c) 2005 James Simmons
* Copyright (c) 2006 Maciej W. Rozycki
*
* Loosely based on drivers/dio/dio-driver.c and
* drivers/pci/pci-driver.c.
*
* This file is subject to the terms and conditions of the GNU
* General Public License. See the file "COPYING" in the main
* directory of this archive for more details.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/tc.h>
/**
* tc_register_driver - register a new TC driver
* @drv: the driver structure to register
*
* Adds the driver structure to the list of registered drivers
* Returns a negative value on error, otherwise 0.
* If no error occurred, the driver remains registered even if
* no device was claimed during registration.
*/
int tc_register_driver(struct tc_driver *tdrv)
{
return driver_register(&tdrv->driver);
}
EXPORT_SYMBOL(tc_register_driver);
/**
* tc_unregister_driver - unregister a TC driver
* @drv: the driver structure to unregister
*
* Deletes the driver structure from the list of registered TC drivers,
* gives it a chance to clean up by calling its remove() function for
* each device it was responsible for, and marks those devices as
* driverless.
*/
void tc_unregister_driver(struct tc_driver *tdrv)
{
driver_unregister(&tdrv->driver);
}
EXPORT_SYMBOL(tc_unregister_driver);
/**
* tc_match_device - tell if a TC device structure has a matching
* TC device ID structure
* @tdrv: the TC driver to earch for matching TC device ID strings
* @tdev: the TC device structure to match against
*
* Used by a driver to check whether a TC device present in the
* system is in its list of supported devices. Returns the matching
* tc_device_id structure or %NULL if there is no match.
*/
const struct tc_device_id *tc_match_device(struct tc_driver *tdrv,
struct tc_dev *tdev)
{
const struct tc_device_id *id = tdrv->id_table;
if (id) {
while (id->name[0] || id->vendor[0]) {
if (strcmp(tdev->name, id->name) == 0 &&
strcmp(tdev->vendor, id->vendor) == 0)
return id;
id++;
}
}
return NULL;
}
EXPORT_SYMBOL(tc_match_device);
/**
* tc_bus_match - Tell if a device structure has a matching
* TC device ID structure
* @dev: the device structure to match against
* @drv: the device driver to search for matching TC device ID strings
*
* Used by a driver to check whether a TC device present in the
* system is in its list of supported devices. Returns 1 if there
* is a match or 0 otherwise.
*/
static int tc_bus_match(struct device *dev, struct device_driver *drv)
{
struct tc_dev *tdev = to_tc_dev(dev);
struct tc_driver *tdrv = to_tc_driver(drv);
const struct tc_device_id *id;
id = tc_match_device(tdrv, tdev);
if (id)
return 1;
return 0;
}
struct bus_type tc_bus_type = {
.name = "tc",
.match = tc_bus_match,
};
EXPORT_SYMBOL(tc_bus_type);
static int __init tc_driver_init(void)
{
return bus_register(&tc_bus_type);
}
postcore_initcall(tc_driver_init);

193
drivers/tc/tc.c Normal file
View File

@@ -0,0 +1,193 @@
/*
* TURBOchannel bus services.
*
* Copyright (c) Harald Koerfgen, 1998
* Copyright (c) 2001, 2003, 2005, 2006 Maciej W. Rozycki
* Copyright (c) 2005 James Simmons
*
* This file is subject to the terms and conditions of the GNU
* General Public License. See the file "COPYING" in the main
* directory of this archive for more details.
*/
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/tc.h>
#include <linux/types.h>
#include <asm/io.h>
static struct tc_bus tc_bus = {
.name = "TURBOchannel",
};
/*
* Probing for TURBOchannel modules.
*/
static void __init tc_bus_add_devices(struct tc_bus *tbus)
{
resource_size_t slotsize = tbus->info.slot_size << 20;
resource_size_t extslotsize = tbus->ext_slot_size;
resource_size_t slotaddr;
resource_size_t extslotaddr;
resource_size_t devsize;
void __iomem *module;
struct tc_dev *tdev;
int i, slot, err;
u8 pattern[4];
long offset;
for (slot = 0; slot < tbus->num_tcslots; slot++) {
slotaddr = tbus->slot_base + slot * slotsize;
extslotaddr = tbus->ext_slot_base + slot * extslotsize;
module = ioremap_nocache(slotaddr, slotsize);
BUG_ON(!module);
offset = TC_OLDCARD;
err = 0;
err |= tc_preadb(pattern + 0, module + offset + TC_PATTERN0);
err |= tc_preadb(pattern + 1, module + offset + TC_PATTERN1);
err |= tc_preadb(pattern + 2, module + offset + TC_PATTERN2);
err |= tc_preadb(pattern + 3, module + offset + TC_PATTERN3);
if (err)
goto out_err;
if (pattern[0] != 0x55 || pattern[1] != 0x00 ||
pattern[2] != 0xaa || pattern[3] != 0xff) {
offset = TC_NEWCARD;
err = 0;
err |= tc_preadb(pattern + 0,
module + offset + TC_PATTERN0);
err |= tc_preadb(pattern + 1,
module + offset + TC_PATTERN1);
err |= tc_preadb(pattern + 2,
module + offset + TC_PATTERN2);
err |= tc_preadb(pattern + 3,
module + offset + TC_PATTERN3);
if (err)
goto out_err;
}
if (pattern[0] != 0x55 || pattern[1] != 0x00 ||
pattern[2] != 0xaa || pattern[3] != 0xff)
goto out_err;
/* Found a board, allocate it an entry in the list */
tdev = kzalloc(sizeof(*tdev), GFP_KERNEL);
if (!tdev) {
printk(KERN_ERR "tc%x: unable to allocate tc_dev\n",
slot);
goto out_err;
}
sprintf(tdev->dev.bus_id, "tc%x", slot);
tdev->bus = tbus;
tdev->dev.parent = &tbus->dev;
tdev->dev.bus = &tc_bus_type;
tdev->slot = slot;
for (i = 0; i < 8; i++) {
tdev->firmware[i] =
readb(module + offset + TC_FIRM_VER + 4 * i);
tdev->vendor[i] =
readb(module + offset + TC_VENDOR + 4 * i);
tdev->name[i] =
readb(module + offset + TC_MODULE + 4 * i);
}
tdev->firmware[8] = 0;
tdev->vendor[8] = 0;
tdev->name[8] = 0;
pr_info("%s: %s %s %s\n", tdev->dev.bus_id, tdev->vendor,
tdev->name, tdev->firmware);
devsize = readb(module + offset + TC_SLOT_SIZE);
devsize <<= 22;
if (devsize <= slotsize) {
tdev->resource.start = slotaddr;
tdev->resource.end = slotaddr + devsize - 1;
} else if (devsize <= extslotsize) {
tdev->resource.start = extslotaddr;
tdev->resource.end = extslotaddr + devsize - 1;
} else {
printk(KERN_ERR "%s: Cannot provide slot space "
"(%dMiB required, up to %dMiB supported)\n",
tdev->dev.bus_id, devsize >> 20,
max(slotsize, extslotsize) >> 20);
kfree(tdev);
goto out_err;
}
tdev->resource.name = tdev->name;
tdev->resource.flags = IORESOURCE_MEM;
tc_device_get_irq(tdev);
device_register(&tdev->dev);
list_add_tail(&tdev->node, &tbus->devices);
out_err:
iounmap(module);
}
}
/*
* The main entry.
*/
static int __init tc_init(void)
{
/* Initialize the TURBOchannel bus */
if (tc_bus_get_info(&tc_bus))
return 0;
INIT_LIST_HEAD(&tc_bus.devices);
strcpy(tc_bus.dev.bus_id, "tc");
device_register(&tc_bus.dev);
if (tc_bus.info.slot_size) {
unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000;
pr_info("tc: TURBOchannel rev. %d at %d.%d MHz "
"(with%s parity)\n", tc_bus.info.revision,
tc_clock / 10, tc_clock % 10,
tc_bus.info.parity ? "" : "out");
tc_bus.resource[0].start = tc_bus.slot_base;
tc_bus.resource[0].end = tc_bus.slot_base +
(tc_bus.info.slot_size << 20) *
tc_bus.num_tcslots - 1;
tc_bus.resource[0].name = tc_bus.name;
tc_bus.resource[0].flags = IORESOURCE_MEM;
if (request_resource(&iomem_resource,
&tc_bus.resource[0]) < 0) {
printk(KERN_ERR "tc: Cannot reserve resource\n");
return 0;
}
if (tc_bus.ext_slot_size) {
tc_bus.resource[1].start = tc_bus.ext_slot_base;
tc_bus.resource[1].end = tc_bus.ext_slot_base +
tc_bus.ext_slot_size *
tc_bus.num_tcslots - 1;
tc_bus.resource[1].name = tc_bus.name;
tc_bus.resource[1].flags = IORESOURCE_MEM;
if (request_resource(&iomem_resource,
&tc_bus.resource[1]) < 0) {
printk(KERN_ERR
"tc: Cannot reserve resource\n");
release_resource(&tc_bus.resource[0]);
return 0;
}
}
tc_bus_add_devices(&tc_bus);
}
return 0;
}
subsys_initcall(tc_init);

2203
drivers/tc/zs.c Normal file

File diff suppressed because it is too large Load Diff

404
drivers/tc/zs.h Normal file
View File

@@ -0,0 +1,404 @@
/*
* drivers/tc/zs.h: Definitions for the DECstation Z85C30 serial driver.
*
* Adapted from drivers/sbus/char/sunserial.h by Paul Mackerras.
* Adapted from drivers/macintosh/macserial.h by Harald Koerfgen.
*
* Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au)
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 2004, 2005 Maciej W. Rozycki
*/
#ifndef _DECSERIAL_H
#define _DECSERIAL_H
#include <asm/dec/serial.h>
#define NUM_ZSREGS 16
struct serial_struct {
int type;
int line;
int port;
int irq;
int flags;
int xmit_fifo_size;
int custom_divisor;
int baud_base;
unsigned short close_delay;
char reserved_char[2];
int hub6;
unsigned short closing_wait; /* time to wait before closing */
unsigned short closing_wait2; /* no longer used... */
int reserved[4];
};
/*
* For the close wait times, 0 means wait forever for serial port to
* flush its output. 65535 means don't wait at all.
*/
#define ZILOG_CLOSING_WAIT_INF 0
#define ZILOG_CLOSING_WAIT_NONE 65535
/*
* Definitions for ZILOG_struct (and serial_struct) flags field
*/
#define ZILOG_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
on the callout port */
#define ZILOG_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
#define ZILOG_SAK 0x0004 /* Secure Attention Key (Orange book) */
#define ZILOG_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
#define ZILOG_SPD_MASK 0x0030
#define ZILOG_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
#define ZILOG_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
#define ZILOG_SPD_CUST 0x0030 /* Use user-specified divisor */
#define ZILOG_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
#define ZILOG_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
#define ZILOG_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
#define ZILOG_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
#define ZILOG_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
#define ZILOG_FLAGS 0x0FFF /* Possible legal ZILOG flags */
#define ZILOG_USR_MASK 0x0430 /* Legal flags that non-privileged
* users can set or reset */
/* Internal flags used only by kernel/chr_drv/serial.c */
#define ZILOG_INITIALIZED 0x80000000 /* Serial port was initialized */
#define ZILOG_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */
#define ZILOG_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
#define ZILOG_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
#define ZILOG_CLOSING 0x08000000 /* Serial port is closing */
#define ZILOG_CTS_FLOW 0x04000000 /* Do CTS flow control */
#define ZILOG_CHECK_CD 0x02000000 /* i.e., CLOCAL */
/* Software state per channel */
#ifdef __KERNEL__
/*
* This is our internal structure for each serial port's state.
*
* Many fields are paralleled by the structure used by the serial_struct
* structure.
*
* For definitions of the flags field, see tty.h
*/
struct dec_zschannel {
volatile unsigned char *control;
volatile unsigned char *data;
/* Current write register values */
unsigned char curregs[NUM_ZSREGS];
};
struct dec_serial {
struct dec_serial *zs_next; /* For IRQ servicing chain. */
struct dec_zschannel *zs_channel; /* Channel registers. */
struct dec_zschannel *zs_chan_a; /* A side registers. */
unsigned char read_reg_zero;
struct dec_serial_hook *hook; /* Hook on this channel. */
int tty_break; /* Set on BREAK condition. */
int is_cons; /* Is this our console. */
int tx_active; /* Char is being xmitted. */
int tx_stopped; /* Output is suspended. */
/*
* We need to know the current clock divisor
* to read the bps rate the chip has currently loaded.
*/
int clk_divisor; /* May be 1, 16, 32, or 64. */
int zs_baud;
char change_needed;
int magic;
int baud_base;
int port;
int irq;
int flags; /* Defined in tty.h. */
int type; /* UART type. */
struct tty_struct *tty;
int read_status_mask;
int ignore_status_mask;
int timeout;
int xmit_fifo_size;
int custom_divisor;
int x_char; /* XON/XOFF character. */
int close_delay;
unsigned short closing_wait;
unsigned short closing_wait2;
unsigned long event;
unsigned long last_active;
int line;
int count; /* # of fds on device. */
int blocked_open; /* # of blocked opens. */
unsigned char *xmit_buf;
int xmit_head;
int xmit_tail;
int xmit_cnt;
struct tasklet_struct tlet;
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
};
#define SERIAL_MAGIC 0x5301
/*
* The size of the serial xmit buffer is 1 page, or 4096 bytes
*/
#define SERIAL_XMIT_SIZE 4096
/*
* Events are used to schedule things to happen at timer-interrupt
* time, instead of at rs interrupt time.
*/
#define RS_EVENT_WRITE_WAKEUP 0
#endif /* __KERNEL__ */
/* Conversion routines to/from brg time constants from/to bits
* per second.
*/
#define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2))
#define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2)
/* The Zilog register set */
#define FLAG 0x7e
/* Write Register 0 */
#define R0 0 /* Register selects */
#define R1 1
#define R2 2
#define R3 3
#define R4 4
#define R5 5
#define R6 6
#define R7 7
#define R8 8
#define R9 9
#define R10 10
#define R11 11
#define R12 12
#define R13 13
#define R14 14
#define R15 15
#define NULLCODE 0 /* Null Code */
#define POINT_HIGH 0x8 /* Select upper half of registers */
#define RES_EXT_INT 0x10 /* Reset Ext. Status Interrupts */
#define SEND_ABORT 0x18 /* HDLC Abort */
#define RES_RxINT_FC 0x20 /* Reset RxINT on First Character */
#define RES_Tx_P 0x28 /* Reset TxINT Pending */
#define ERR_RES 0x30 /* Error Reset */
#define RES_H_IUS 0x38 /* Reset highest IUS */
#define RES_Rx_CRC 0x40 /* Reset Rx CRC Checker */
#define RES_Tx_CRC 0x80 /* Reset Tx CRC Checker */
#define RES_EOM_L 0xC0 /* Reset EOM latch */
/* Write Register 1 */
#define EXT_INT_ENAB 0x1 /* Ext Int Enable */
#define TxINT_ENAB 0x2 /* Tx Int Enable */
#define PAR_SPEC 0x4 /* Parity is special condition */
#define RxINT_DISAB 0 /* Rx Int Disable */
#define RxINT_FCERR 0x8 /* Rx Int on First Character Only or Error */
#define RxINT_ALL 0x10 /* Int on all Rx Characters or error */
#define RxINT_ERR 0x18 /* Int on error only */
#define RxINT_MASK 0x18
#define WT_RDY_RT 0x20 /* Wait/Ready on R/T */
#define WT_FN_RDYFN 0x40 /* Wait/FN/Ready FN */
#define WT_RDY_ENAB 0x80 /* Wait/Ready Enable */
/* Write Register #2 (Interrupt Vector) */
/* Write Register 3 */
#define RxENABLE 0x1 /* Rx Enable */
#define SYNC_L_INH 0x2 /* Sync Character Load Inhibit */
#define ADD_SM 0x4 /* Address Search Mode (SDLC) */
#define RxCRC_ENAB 0x8 /* Rx CRC Enable */
#define ENT_HM 0x10 /* Enter Hunt Mode */
#define AUTO_ENAB 0x20 /* Auto Enables */
#define Rx5 0x0 /* Rx 5 Bits/Character */
#define Rx7 0x40 /* Rx 7 Bits/Character */
#define Rx6 0x80 /* Rx 6 Bits/Character */
#define Rx8 0xc0 /* Rx 8 Bits/Character */
#define RxNBITS_MASK 0xc0
/* Write Register 4 */
#define PAR_ENA 0x1 /* Parity Enable */
#define PAR_EVEN 0x2 /* Parity Even/Odd* */
#define SYNC_ENAB 0 /* Sync Modes Enable */
#define SB1 0x4 /* 1 stop bit/char */
#define SB15 0x8 /* 1.5 stop bits/char */
#define SB2 0xc /* 2 stop bits/char */
#define SB_MASK 0xc
#define MONSYNC 0 /* 8 Bit Sync character */
#define BISYNC 0x10 /* 16 bit sync character */
#define SDLC 0x20 /* SDLC Mode (01111110 Sync Flag) */
#define EXTSYNC 0x30 /* External Sync Mode */
#define X1CLK 0x0 /* x1 clock mode */
#define X16CLK 0x40 /* x16 clock mode */
#define X32CLK 0x80 /* x32 clock mode */
#define X64CLK 0xC0 /* x64 clock mode */
#define XCLK_MASK 0xC0
/* Write Register 5 */
#define TxCRC_ENAB 0x1 /* Tx CRC Enable */
#define RTS 0x2 /* RTS */
#define SDLC_CRC 0x4 /* SDLC/CRC-16 */
#define TxENAB 0x8 /* Tx Enable */
#define SND_BRK 0x10 /* Send Break */
#define Tx5 0x0 /* Tx 5 bits (or less)/character */
#define Tx7 0x20 /* Tx 7 bits/character */
#define Tx6 0x40 /* Tx 6 bits/character */
#define Tx8 0x60 /* Tx 8 bits/character */
#define TxNBITS_MASK 0x60
#define DTR 0x80 /* DTR */
/* Write Register 6 (Sync bits 0-7/SDLC Address Field) */
/* Write Register 7 (Sync bits 8-15/SDLC 01111110) */
/* Write Register 8 (transmit buffer) */
/* Write Register 9 (Master interrupt control) */
#define VIS 1 /* Vector Includes Status */
#define NV 2 /* No Vector */
#define DLC 4 /* Disable Lower Chain */
#define MIE 8 /* Master Interrupt Enable */
#define STATHI 0x10 /* Status high */
#define SOFTACK 0x20 /* Software Interrupt Acknowledge */
#define NORESET 0 /* No reset on write to R9 */
#define CHRB 0x40 /* Reset channel B */
#define CHRA 0x80 /* Reset channel A */
#define FHWRES 0xc0 /* Force hardware reset */
/* Write Register 10 (misc control bits) */
#define BIT6 1 /* 6 bit/8bit sync */
#define LOOPMODE 2 /* SDLC Loop mode */
#define ABUNDER 4 /* Abort/flag on SDLC xmit underrun */
#define MARKIDLE 8 /* Mark/flag on idle */
#define GAOP 0x10 /* Go active on poll */
#define NRZ 0 /* NRZ mode */
#define NRZI 0x20 /* NRZI mode */
#define FM1 0x40 /* FM1 (transition = 1) */
#define FM0 0x60 /* FM0 (transition = 0) */
#define CRCPS 0x80 /* CRC Preset I/O */
/* Write Register 11 (Clock Mode control) */
#define TRxCXT 0 /* TRxC = Xtal output */
#define TRxCTC 1 /* TRxC = Transmit clock */
#define TRxCBR 2 /* TRxC = BR Generator Output */
#define TRxCDP 3 /* TRxC = DPLL output */
#define TRxCOI 4 /* TRxC O/I */
#define TCRTxCP 0 /* Transmit clock = RTxC pin */
#define TCTRxCP 8 /* Transmit clock = TRxC pin */
#define TCBR 0x10 /* Transmit clock = BR Generator output */
#define TCDPLL 0x18 /* Transmit clock = DPLL output */
#define RCRTxCP 0 /* Receive clock = RTxC pin */
#define RCTRxCP 0x20 /* Receive clock = TRxC pin */
#define RCBR 0x40 /* Receive clock = BR Generator output */
#define RCDPLL 0x60 /* Receive clock = DPLL output */
#define RTxCX 0x80 /* RTxC Xtal/No Xtal */
/* Write Register 12 (lower byte of baud rate generator time constant) */
/* Write Register 13 (upper byte of baud rate generator time constant) */
/* Write Register 14 (Misc control bits) */
#define BRENABL 1 /* Baud rate generator enable */
#define BRSRC 2 /* Baud rate generator source */
#define DTRREQ 4 /* DTR/Request function */
#define AUTOECHO 8 /* Auto Echo */
#define LOOPBAK 0x10 /* Local loopback */
#define SEARCH 0x20 /* Enter search mode */
#define RMC 0x40 /* Reset missing clock */
#define DISDPLL 0x60 /* Disable DPLL */
#define SSBR 0x80 /* Set DPLL source = BR generator */
#define SSRTxC 0xa0 /* Set DPLL source = RTxC */
#define SFMM 0xc0 /* Set FM mode */
#define SNRZI 0xe0 /* Set NRZI mode */
/* Write Register 15 (external/status interrupt control) */
#define ZCIE 2 /* Zero count IE */
#define DCDIE 8 /* DCD IE */
#define SYNCIE 0x10 /* Sync/hunt IE */
#define CTSIE 0x20 /* CTS IE */
#define TxUIE 0x40 /* Tx Underrun/EOM IE */
#define BRKIE 0x80 /* Break/Abort IE */
/* Read Register 0 */
#define Rx_CH_AV 0x1 /* Rx Character Available */
#define ZCOUNT 0x2 /* Zero count */
#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */
#define DCD 0x8 /* DCD */
#define SYNC_HUNT 0x10 /* Sync/hunt */
#define CTS 0x20 /* CTS */
#define TxEOM 0x40 /* Tx underrun */
#define BRK_ABRT 0x80 /* Break/Abort */
/* Read Register 1 */
#define ALL_SNT 0x1 /* All sent */
/* Residue Data for 8 Rx bits/char programmed */
#define RES3 0x8 /* 0/3 */
#define RES4 0x4 /* 0/4 */
#define RES5 0xc /* 0/5 */
#define RES6 0x2 /* 0/6 */
#define RES7 0xa /* 0/7 */
#define RES8 0x6 /* 0/8 */
#define RES18 0xe /* 1/8 */
#define RES28 0x0 /* 2/8 */
/* Special Rx Condition Interrupts */
#define PAR_ERR 0x10 /* Parity error */
#define Rx_OVR 0x20 /* Rx Overrun Error */
#define FRM_ERR 0x40 /* CRC/Framing Error */
#define END_FR 0x80 /* End of Frame (SDLC) */
/* Read Register 2 (channel b only) - Interrupt vector */
/* Read Register 3 (interrupt pending register) ch a only */
#define CHBEXT 0x1 /* Channel B Ext/Stat IP */
#define CHBTxIP 0x2 /* Channel B Tx IP */
#define CHBRxIP 0x4 /* Channel B Rx IP */
#define CHAEXT 0x8 /* Channel A Ext/Stat IP */
#define CHATxIP 0x10 /* Channel A Tx IP */
#define CHARxIP 0x20 /* Channel A Rx IP */
/* Read Register 8 (receive data register) */
/* Read Register 10 (misc status bits) */
#define ONLOOP 2 /* On loop */
#define LOOPSEND 0x10 /* Loop sending */
#define CLK2MIS 0x40 /* Two clocks missing */
#define CLK1MIS 0x80 /* One clock missing */
/* Read Register 12 (lower byte of baud rate generator constant) */
/* Read Register 13 (upper byte of baud rate generator constant) */
/* Read Register 15 (value of WR 15) */
/* Misc macros */
#define ZS_CLEARERR(channel) (write_zsreg(channel, 0, ERR_RES))
#define ZS_CLEARFIFO(channel) do { volatile unsigned char garbage; \
garbage = read_zsdata(channel); \
garbage = read_zsdata(channel); \
garbage = read_zsdata(channel); \
} while(0)
#endif /* !(_DECSERIAL_H) */