Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ae5ec6fe
Commit
ae5ec6fe
authored
Sep 23, 2002
by
Vojtech Pavlik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove several files no longer used on m68k.
Input layer now handles those devices.
parent
e8d5b0ba
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
2819 deletions
+0
-2819
arch/m68k/atari/atakeyb.c
arch/m68k/atari/atakeyb.c
+0
-877
arch/m68k/atari/joystick.c
arch/m68k/atari/joystick.c
+0
-144
arch/m68k/hp300/hil.c
arch/m68k/hp300/hil.c
+0
-344
drivers/char/amikeyb.c
drivers/char/amikeyb.c
+0
-359
drivers/char/atarimouse.c
drivers/char/atarimouse.c
+0
-136
drivers/char/dn_keyb.c
drivers/char/dn_keyb.c
+0
-483
drivers/char/q40_keyb.c
drivers/char/q40_keyb.c
+0
-443
include/asm-m68k/q40_keyboard.h
include/asm-m68k/q40_keyboard.h
+0
-33
No files found.
arch/m68k/atari/atakeyb.c
deleted
100644 → 0
View file @
e8d5b0ba
/*
* linux/atari/atakeyb.c
*
* Atari Keyboard driver for 680x0 Linux
*
* 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.
*/
/*
* Atari support by Robert de Vries
* enhanced by Bjoern Brauel and Roman Hodek
*/
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/keyboard.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/kd.h>
#include <linux/random.h>
#include <linux/init.h>
#include <linux/kbd_ll.h>
#include <linux/kbd_kern.h>
#include <asm/atariints.h>
#include <asm/atarihw.h>
#include <asm/atarikb.h>
#include <asm/atari_joystick.h>
#include <asm/irq.h>
static
void
atakeyb_rep
(
unsigned
long
ignore
);
extern
unsigned
int
keymap_count
;
/* Hook for MIDI serial driver */
void
(
*
atari_MIDI_interrupt_hook
)
(
void
);
/* Hook for mouse driver */
void
(
*
atari_mouse_interrupt_hook
)
(
char
*
);
/* variables for IKBD self test: */
/* state: 0: off; >0: in progress; >1: 0xf1 received */
static
volatile
int
ikbd_self_test
;
/* timestamp when last received a char */
static
volatile
unsigned
long
self_test_last_rcv
;
/* bitmap of keys reported as broken */
static
unsigned
long
broken_keys
[
128
/
(
sizeof
(
unsigned
long
)
*
8
)]
=
{
0
,
};
#define BREAK_MASK (0x80)
/*
* ++roman: The following changes were applied manually:
*
* - The Alt (= Meta) key works in combination with Shift and
* Control, e.g. Alt+Shift+a sends Meta-A (0xc1), Alt+Control+A sends
* Meta-Ctrl-A (0x81) ...
*
* - The parentheses on the keypad send '(' and ')' with all
* modifiers (as would do e.g. keypad '+'), but they cannot be used as
* application keys (i.e. sending Esc O c).
*
* - HELP and UNDO are mapped to be F21 and F24, resp, that send the
* codes "\E[M" and "\E[P". (This is better than the old mapping to
* F11 and F12, because these codes are on Shift+F1/2 anyway.) This
* way, applications that allow their own keyboard mappings
* (e.g. tcsh, X Windows) can be configured to use them in the way
* the label suggests (providing help or undoing).
*
* - Console switching is done with Alt+Fx (consoles 1..10) and
* Shift+Alt+Fx (consoles 11..20).
*
* - The misc. special function implemented in the kernel are mapped
* to the following key combinations:
*
* ClrHome -> Home/Find
* Shift + ClrHome -> End/Select
* Shift + Up -> Page Up
* Shift + Down -> Page Down
* Alt + Help -> show system status
* Shift + Help -> show memory info
* Ctrl + Help -> show registers
* Ctrl + Alt + Del -> Reboot
* Alt + Undo -> switch to last console
* Shift + Undo -> send interrupt
* Alt + Insert -> stop/start output (same as ^S/^Q)
* Alt + Up -> Scroll back console (if implemented)
* Alt + Down -> Scroll forward console (if implemented)
* Alt + CapsLock -> NumLock
*
* ++Andreas:
*
* - Help mapped to K_HELP
* - Undo mapped to K_UNDO (= K_F246)
* - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
*/
static
u_short
ataplain_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf01b
,
0xf031
,
0xf032
,
0xf033
,
0xf034
,
0xf035
,
0xf036
,
0xf037
,
0xf038
,
0xf039
,
0xf030
,
0xf02d
,
0xf03d
,
0xf008
,
0xf009
,
0xfb71
,
0xfb77
,
0xfb65
,
0xfb72
,
0xfb74
,
0xfb79
,
0xfb75
,
0xfb69
,
0xfb6f
,
0xfb70
,
0xf05b
,
0xf05d
,
0xf201
,
0xf702
,
0xfb61
,
0xfb73
,
0xfb64
,
0xfb66
,
0xfb67
,
0xfb68
,
0xfb6a
,
0xfb6b
,
0xfb6c
,
0xf03b
,
0xf027
,
0xf060
,
0xf700
,
0xf05c
,
0xfb7a
,
0xfb78
,
0xfb63
,
0xfb76
,
0xfb62
,
0xfb6e
,
0xfb6d
,
0xf02c
,
0xf02e
,
0xf02f
,
0xf700
,
0xf200
,
0xf703
,
0xf020
,
0xf207
,
0xf100
,
0xf101
,
0xf102
,
0xf103
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf108
,
0xf109
,
0xf200
,
0xf200
,
0xf114
,
0xf603
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf600
,
0xf200
,
0xf115
,
0xf07f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf1ff
,
0xf11b
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf307
,
0xf308
,
0xf309
,
0xf304
,
0xf305
,
0xf306
,
0xf301
,
0xf302
,
0xf303
,
0xf300
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
atashift_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf01b
,
0xf021
,
0xf040
,
0xf023
,
0xf024
,
0xf025
,
0xf05e
,
0xf026
,
0xf02a
,
0xf028
,
0xf029
,
0xf05f
,
0xf02b
,
0xf008
,
0xf009
,
0xfb51
,
0xfb57
,
0xfb45
,
0xfb52
,
0xfb54
,
0xfb59
,
0xfb55
,
0xfb49
,
0xfb4f
,
0xfb50
,
0xf07b
,
0xf07d
,
0xf201
,
0xf702
,
0xfb41
,
0xfb53
,
0xfb44
,
0xfb46
,
0xfb47
,
0xfb48
,
0xfb4a
,
0xfb4b
,
0xfb4c
,
0xf03a
,
0xf022
,
0xf07e
,
0xf700
,
0xf07c
,
0xfb5a
,
0xfb58
,
0xfb43
,
0xfb56
,
0xfb42
,
0xfb4e
,
0xfb4d
,
0xf03c
,
0xf03e
,
0xf03f
,
0xf700
,
0xf200
,
0xf703
,
0xf020
,
0xf207
,
0xf10a
,
0xf10b
,
0xf10c
,
0xf10d
,
0xf10e
,
0xf10f
,
0xf110
,
0xf111
,
0xf112
,
0xf113
,
0xf200
,
0xf200
,
0xf117
,
0xf118
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf119
,
0xf200
,
0xf115
,
0xf07f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf205
,
0xf203
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf307
,
0xf308
,
0xf309
,
0xf304
,
0xf305
,
0xf306
,
0xf301
,
0xf302
,
0xf303
,
0xf300
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
atactrl_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf000
,
0xf01b
,
0xf01c
,
0xf01d
,
0xf01e
,
0xf01f
,
0xf07f
,
0xf200
,
0xf200
,
0xf01f
,
0xf200
,
0xf008
,
0xf200
,
0xf011
,
0xf017
,
0xf005
,
0xf012
,
0xf014
,
0xf019
,
0xf015
,
0xf009
,
0xf00f
,
0xf010
,
0xf01b
,
0xf01d
,
0xf201
,
0xf702
,
0xf001
,
0xf013
,
0xf004
,
0xf006
,
0xf007
,
0xf008
,
0xf00a
,
0xf00b
,
0xf00c
,
0xf200
,
0xf007
,
0xf000
,
0xf700
,
0xf01c
,
0xf01a
,
0xf018
,
0xf003
,
0xf016
,
0xf002
,
0xf00e
,
0xf00d
,
0xf200
,
0xf200
,
0xf07f
,
0xf700
,
0xf200
,
0xf703
,
0xf000
,
0xf207
,
0xf100
,
0xf101
,
0xf102
,
0xf103
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf108
,
0xf109
,
0xf200
,
0xf200
,
0xf114
,
0xf603
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf600
,
0xf200
,
0xf115
,
0xf07f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf1ff
,
0xf202
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf307
,
0xf308
,
0xf309
,
0xf304
,
0xf305
,
0xf306
,
0xf301
,
0xf302
,
0xf303
,
0xf300
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
atashift_ctrl_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf01f
,
0xf200
,
0xf008
,
0xf200
,
0xf011
,
0xf017
,
0xf005
,
0xf012
,
0xf014
,
0xf019
,
0xf015
,
0xf009
,
0xf00f
,
0xf010
,
0xf200
,
0xf200
,
0xf201
,
0xf702
,
0xf001
,
0xf013
,
0xf004
,
0xf006
,
0xf007
,
0xf008
,
0xf00a
,
0xf00b
,
0xf00c
,
0xf200
,
0xf200
,
0xf200
,
0xf700
,
0xf200
,
0xf01a
,
0xf018
,
0xf003
,
0xf016
,
0xf002
,
0xf00e
,
0xf00d
,
0xf200
,
0xf200
,
0xf07f
,
0xf700
,
0xf200
,
0xf703
,
0xf200
,
0xf207
,
0xf100
,
0xf101
,
0xf102
,
0xf103
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf108
,
0xf109
,
0xf200
,
0xf200
,
0xf117
,
0xf603
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf600
,
0xf200
,
0xf115
,
0xf07f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf1ff
,
0xf11b
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf307
,
0xf308
,
0xf309
,
0xf304
,
0xf305
,
0xf306
,
0xf301
,
0xf302
,
0xf303
,
0xf300
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
ataalt_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf81b
,
0xf831
,
0xf832
,
0xf833
,
0xf834
,
0xf835
,
0xf836
,
0xf837
,
0xf838
,
0xf839
,
0xf830
,
0xf82d
,
0xf83d
,
0xf808
,
0xf809
,
0xf871
,
0xf877
,
0xf865
,
0xf872
,
0xf874
,
0xf879
,
0xf875
,
0xf869
,
0xf86f
,
0xf870
,
0xf85b
,
0xf85d
,
0xf80d
,
0xf702
,
0xf861
,
0xf873
,
0xf864
,
0xf866
,
0xf867
,
0xf868
,
0xf86a
,
0xf86b
,
0xf86c
,
0xf83b
,
0xf827
,
0xf860
,
0xf700
,
0xf85c
,
0xf87a
,
0xf878
,
0xf863
,
0xf876
,
0xf862
,
0xf86e
,
0xf86d
,
0xf82c
,
0xf82e
,
0xf82f
,
0xf700
,
0xf200
,
0xf703
,
0xf820
,
0xf208
,
0xf500
,
0xf501
,
0xf502
,
0xf503
,
0xf504
,
0xf505
,
0xf506
,
0xf507
,
0xf508
,
0xf509
,
0xf200
,
0xf200
,
0xf114
,
0xf20b
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf20a
,
0xf200
,
0xf209
,
0xf87f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf206
,
0xf204
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf907
,
0xf908
,
0xf909
,
0xf904
,
0xf905
,
0xf906
,
0xf901
,
0xf902
,
0xf903
,
0xf900
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
atashift_alt_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf81b
,
0xf821
,
0xf840
,
0xf823
,
0xf824
,
0xf825
,
0xf85e
,
0xf826
,
0xf82a
,
0xf828
,
0xf829
,
0xf85f
,
0xf82b
,
0xf808
,
0xf809
,
0xf851
,
0xf857
,
0xf845
,
0xf852
,
0xf854
,
0xf859
,
0xf855
,
0xf849
,
0xf84f
,
0xf850
,
0xf87b
,
0xf87d
,
0xf201
,
0xf702
,
0xf841
,
0xf853
,
0xf844
,
0xf846
,
0xf847
,
0xf848
,
0xf84a
,
0xf84b
,
0xf84c
,
0xf83a
,
0xf822
,
0xf87e
,
0xf700
,
0xf87c
,
0xf85a
,
0xf858
,
0xf843
,
0xf856
,
0xf842
,
0xf84e
,
0xf84d
,
0xf83c
,
0xf83e
,
0xf83f
,
0xf700
,
0xf200
,
0xf703
,
0xf820
,
0xf207
,
0xf50a
,
0xf50b
,
0xf50c
,
0xf50d
,
0xf50e
,
0xf50f
,
0xf510
,
0xf511
,
0xf512
,
0xf513
,
0xf200
,
0xf200
,
0xf117
,
0xf118
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf119
,
0xf200
,
0xf115
,
0xf87f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf1ff
,
0xf11b
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf307
,
0xf308
,
0xf309
,
0xf304
,
0xf305
,
0xf306
,
0xf301
,
0xf302
,
0xf303
,
0xf300
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
atactrl_alt_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf800
,
0xf81b
,
0xf81c
,
0xf81d
,
0xf81e
,
0xf81f
,
0xf87f
,
0xf200
,
0xf200
,
0xf81f
,
0xf200
,
0xf808
,
0xf200
,
0xf811
,
0xf817
,
0xf805
,
0xf812
,
0xf814
,
0xf819
,
0xf815
,
0xf809
,
0xf80f
,
0xf810
,
0xf81b
,
0xf81d
,
0xf201
,
0xf702
,
0xf801
,
0xf813
,
0xf804
,
0xf806
,
0xf807
,
0xf808
,
0xf80a
,
0xf80b
,
0xf80c
,
0xf200
,
0xf807
,
0xf800
,
0xf700
,
0xf81c
,
0xf81a
,
0xf818
,
0xf803
,
0xf816
,
0xf802
,
0xf80e
,
0xf80d
,
0xf200
,
0xf200
,
0xf87f
,
0xf700
,
0xf200
,
0xf703
,
0xf800
,
0xf207
,
0xf100
,
0xf101
,
0xf102
,
0xf103
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf108
,
0xf109
,
0xf200
,
0xf200
,
0xf114
,
0xf603
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf600
,
0xf200
,
0xf115
,
0xf87f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf1ff
,
0xf202
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf307
,
0xf308
,
0xf309
,
0xf304
,
0xf305
,
0xf306
,
0xf301
,
0xf302
,
0xf303
,
0xf300
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
atashift_ctrl_alt_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf81f
,
0xf200
,
0xf808
,
0xf200
,
0xf811
,
0xf817
,
0xf805
,
0xf812
,
0xf814
,
0xf819
,
0xf815
,
0xf809
,
0xf80f
,
0xf810
,
0xf200
,
0xf200
,
0xf201
,
0xf702
,
0xf801
,
0xf813
,
0xf804
,
0xf806
,
0xf807
,
0xf808
,
0xf80a
,
0xf80b
,
0xf80c
,
0xf200
,
0xf200
,
0xf200
,
0xf700
,
0xf200
,
0xf81a
,
0xf818
,
0xf803
,
0xf816
,
0xf802
,
0xf80e
,
0xf80d
,
0xf200
,
0xf200
,
0xf87f
,
0xf700
,
0xf200
,
0xf703
,
0xf200
,
0xf207
,
0xf100
,
0xf101
,
0xf102
,
0xf103
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf108
,
0xf109
,
0xf200
,
0xf200
,
0xf117
,
0xf603
,
0xf200
,
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf30a
,
0xf200
,
0xf600
,
0xf200
,
0xf115
,
0xf87f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf1ff
,
0xf11b
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf307
,
0xf308
,
0xf309
,
0xf304
,
0xf305
,
0xf306
,
0xf301
,
0xf302
,
0xf303
,
0xf300
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
typedef
enum
kb_state_t
{
KEYBOARD
,
AMOUSE
,
RMOUSE
,
JOYSTICK
,
CLOCK
,
RESYNC
}
KB_STATE_T
;
#define IS_SYNC_CODE(sc) ((sc) >= 0x04 && (sc) <= 0xfb)
typedef
struct
keyboard_state
{
unsigned
char
buf
[
6
];
int
len
;
KB_STATE_T
state
;
}
KEYBOARD_STATE
;
KEYBOARD_STATE
kb_state
;
#define DEFAULT_KEYB_REP_DELAY (HZ/4)
#define DEFAULT_KEYB_REP_RATE (HZ/25)
/* These could be settable by some ioctl() in future... */
static
unsigned
int
key_repeat_delay
=
DEFAULT_KEYB_REP_DELAY
;
static
unsigned
int
key_repeat_rate
=
DEFAULT_KEYB_REP_RATE
;
static
unsigned
char
rep_scancode
;
static
struct
timer_list
atakeyb_rep_timer
=
{
function
:
atakeyb_rep
};
static
void
atakeyb_rep
(
unsigned
long
ignore
)
{
kbd_pt_regs
=
NULL
;
/* Disable keyboard for the time we call handle_scancode(), else a race
* in the keyboard tty queue may happen */
atari_disable_irq
(
IRQ_MFP_ACIA
);
del_timer
(
&
atakeyb_rep_timer
);
/* A keyboard int may have come in before we disabled the irq, so
* double-check whether rep_scancode is still != 0 */
if
(
rep_scancode
)
{
init_timer
(
&
atakeyb_rep_timer
);
atakeyb_rep_timer
.
expires
=
jiffies
+
key_repeat_rate
;
add_timer
(
&
atakeyb_rep_timer
);
handle_scancode
(
rep_scancode
,
1
);
}
atari_enable_irq
(
IRQ_MFP_ACIA
);
}
/* ++roman: If a keyboard overrun happened, we can't tell in general how much
* bytes have been lost and in which state of the packet structure we are now.
* This usually causes keyboards bytes to be interpreted as mouse movements
* and vice versa, which is very annoying. It seems better to throw away some
* bytes (that are usually mouse bytes) than to misinterpret them. Therefor I
* introduced the RESYNC state for IKBD data. In this state, the bytes up to
* one that really looks like a key event (0x04..0xf2) or the start of a mouse
* packet (0xf8..0xfb) are thrown away, but at most 2 bytes. This at least
* speeds up the resynchronization of the event structure, even if maybe a
* mouse movement is lost. However, nothing is perfect. For bytes 0x01..0x03,
* it's really hard to decide whether they're mouse or keyboard bytes. Since
* overruns usually occur when moving the Atari mouse rapidly, they're seen as
* mouse bytes here. If this is wrong, only a make code of the keyboard gets
* lost, which isn't too bad. Loosing a break code would be disastrous,
* because then the keyboard repeat strikes...
*/
static
void
keyboard_interrupt
(
int
irq
,
void
*
dummy
,
struct
pt_regs
*
fp
)
{
u_char
acia_stat
;
int
scancode
;
int
break_flag
;
/* save frame for register dump */
kbd_pt_regs
=
fp
;
repeat:
if
(
acia
.
mid_ctrl
&
ACIA_IRQ
)
if
(
atari_MIDI_interrupt_hook
)
atari_MIDI_interrupt_hook
();
acia_stat
=
acia
.
key_ctrl
;
/* check out if the interrupt came from this ACIA */
if
(
!
((
acia_stat
|
acia
.
mid_ctrl
)
&
ACIA_IRQ
))
return
;
if
(
acia_stat
&
ACIA_OVRN
)
{
/* a very fast typist or a slow system, give a warning */
/* ...happens often if interrupts were disabled for too long */
printk
(
KERN_DEBUG
"Keyboard overrun
\n
"
);
scancode
=
acia
.
key_data
;
/* Turn off autorepeating in case a break code has been lost */
del_timer
(
&
atakeyb_rep_timer
);
rep_scancode
=
0
;
if
(
ikbd_self_test
)
/* During self test, don't do resyncing, just process the code */
goto
interpret_scancode
;
else
if
(
IS_SYNC_CODE
(
scancode
))
{
/* This code seem already to be the start of a new packet or a
* single scancode */
kb_state
.
state
=
KEYBOARD
;
goto
interpret_scancode
;
}
else
{
/* Go to RESYNC state and skip this byte */
kb_state
.
state
=
RESYNC
;
kb_state
.
len
=
1
;
/* skip max. 1 another byte */
goto
repeat
;
}
}
if
(
acia_stat
&
ACIA_RDRF
)
/* received a character */
{
scancode
=
acia
.
key_data
;
/* get it or reset the ACIA, I'll get it! */
tasklet_schedule
(
&
keyboard_tasklet
);
interpret_scancode:
switch
(
kb_state
.
state
)
{
case
KEYBOARD
:
switch
(
scancode
)
{
case
0xF7
:
kb_state
.
state
=
AMOUSE
;
kb_state
.
len
=
0
;
break
;
case
0xF8
:
case
0xF9
:
case
0xFA
:
case
0xFB
:
kb_state
.
state
=
RMOUSE
;
kb_state
.
len
=
1
;
kb_state
.
buf
[
0
]
=
scancode
;
break
;
case
0xFC
:
kb_state
.
state
=
CLOCK
;
kb_state
.
len
=
0
;
break
;
case
0xFE
:
case
0xFF
:
kb_state
.
state
=
JOYSTICK
;
kb_state
.
len
=
1
;
kb_state
.
buf
[
0
]
=
scancode
;
break
;
case
0xF1
:
/* during self-test, note that 0xf1 received */
if
(
ikbd_self_test
)
{
++
ikbd_self_test
;
self_test_last_rcv
=
jiffies
;
break
;
}
/* FALL THROUGH */
default:
break_flag
=
scancode
&
BREAK_MASK
;
scancode
&=
~
BREAK_MASK
;
if
(
ikbd_self_test
)
{
/* Scancodes sent during the self-test stand for broken
* keys (keys being down). The code *should* be a break
* code, but nevertheless some AT keyboard interfaces send
* make codes instead. Therefore, simply ignore
* break_flag...
* */
int
keyval
=
plain_map
[
scancode
],
keytyp
;
set_bit
(
scancode
,
broken_keys
);
self_test_last_rcv
=
jiffies
;
keyval
=
plain_map
[
scancode
];
keytyp
=
KTYP
(
keyval
)
-
0xf0
;
keyval
=
KVAL
(
keyval
);
printk
(
KERN_WARNING
"Key with scancode %d "
,
scancode
);
if
(
keytyp
==
KT_LATIN
||
keytyp
==
KT_LETTER
)
{
if
(
keyval
<
' '
)
printk
(
"('^%c') "
,
keyval
+
'@'
);
else
printk
(
"('%c') "
,
keyval
);
}
printk
(
"is broken -- will be ignored.
\n
"
);
break
;
}
else
if
(
test_bit
(
scancode
,
broken_keys
))
break
;
if
(
break_flag
)
{
del_timer
(
&
atakeyb_rep_timer
);
rep_scancode
=
0
;
}
else
{
del_timer
(
&
atakeyb_rep_timer
);
rep_scancode
=
scancode
;
atakeyb_rep_timer
.
expires
=
jiffies
+
key_repeat_delay
;
add_timer
(
&
atakeyb_rep_timer
);
}
handle_scancode
(
scancode
,
!
break_flag
);
break
;
}
break
;
case
AMOUSE
:
kb_state
.
buf
[
kb_state
.
len
++
]
=
scancode
;
if
(
kb_state
.
len
==
5
)
{
kb_state
.
state
=
KEYBOARD
;
/* not yet used */
/* wake up someone waiting for this */
}
break
;
case
RMOUSE
:
kb_state
.
buf
[
kb_state
.
len
++
]
=
scancode
;
if
(
kb_state
.
len
==
3
)
{
kb_state
.
state
=
KEYBOARD
;
if
(
atari_mouse_interrupt_hook
)
atari_mouse_interrupt_hook
(
kb_state
.
buf
);
}
break
;
case
JOYSTICK
:
kb_state
.
buf
[
1
]
=
scancode
;
kb_state
.
state
=
KEYBOARD
;
atari_joystick_interrupt
(
kb_state
.
buf
);
break
;
case
CLOCK
:
kb_state
.
buf
[
kb_state
.
len
++
]
=
scancode
;
if
(
kb_state
.
len
==
6
)
{
kb_state
.
state
=
KEYBOARD
;
/* wake up someone waiting for this.
But will this ever be used, as Linux keeps its own time.
Perhaps for synchronization purposes? */
/* wake_up_interruptible(&clock_wait); */
}
break
;
case
RESYNC
:
if
(
kb_state
.
len
<=
0
||
IS_SYNC_CODE
(
scancode
))
{
kb_state
.
state
=
KEYBOARD
;
goto
interpret_scancode
;
}
kb_state
.
len
--
;
break
;
}
}
#if 0
if (acia_stat & ACIA_CTS)
/* cannot happen */;
#endif
if
(
acia_stat
&
(
ACIA_FE
|
ACIA_PE
))
{
printk
(
"Error in keyboard communication
\n
"
);
}
/* handle_scancode() can take a lot of time, so check again if
* some character arrived
*/
goto
repeat
;
}
/*
* I write to the keyboard without using interrupts, I poll instead.
* This takes for the maximum length string allowed (7) at 7812.5 baud
* 8 data 1 start 1 stop bit: 9.0 ms
* If this takes too long for normal operation, interrupt driven writing
* is the solution. (I made a feeble attempt in that direction but I
* kept it simple for now.)
*/
void
ikbd_write
(
const
char
*
str
,
int
len
)
{
u_char
acia_stat
;
if
((
len
<
1
)
||
(
len
>
7
))
panic
(
"ikbd: maximum string length exceeded"
);
while
(
len
)
{
acia_stat
=
acia
.
key_ctrl
;
if
(
acia_stat
&
ACIA_TDRE
)
{
acia
.
key_data
=
*
str
++
;
len
--
;
}
}
}
/* Reset (without touching the clock) */
void
ikbd_reset
(
void
)
{
static
const
char
cmd
[
2
]
=
{
0x80
,
0x01
};
ikbd_write
(
cmd
,
2
);
/* if all's well code 0xF1 is returned, else the break codes of
all keys making contact */
}
/* Set mouse button action */
void
ikbd_mouse_button_action
(
int
mode
)
{
char
cmd
[
2
]
=
{
0x07
,
mode
};
ikbd_write
(
cmd
,
2
);
}
/* Set relative mouse position reporting */
void
ikbd_mouse_rel_pos
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x08
};
ikbd_write
(
cmd
,
1
);
}
/* Set absolute mouse position reporting */
void
ikbd_mouse_abs_pos
(
int
xmax
,
int
ymax
)
{
char
cmd
[
5
]
=
{
0x09
,
xmax
>>
8
,
xmax
&
0xFF
,
ymax
>>
8
,
ymax
&
0xFF
};
ikbd_write
(
cmd
,
5
);
}
/* Set mouse keycode mode */
void
ikbd_mouse_kbd_mode
(
int
dx
,
int
dy
)
{
char
cmd
[
3
]
=
{
0x0A
,
dx
,
dy
};
ikbd_write
(
cmd
,
3
);
}
/* Set mouse threshold */
void
ikbd_mouse_thresh
(
int
x
,
int
y
)
{
char
cmd
[
3
]
=
{
0x0B
,
x
,
y
};
ikbd_write
(
cmd
,
3
);
}
/* Set mouse scale */
void
ikbd_mouse_scale
(
int
x
,
int
y
)
{
char
cmd
[
3
]
=
{
0x0C
,
x
,
y
};
ikbd_write
(
cmd
,
3
);
}
/* Interrogate mouse position */
void
ikbd_mouse_pos_get
(
int
*
x
,
int
*
y
)
{
static
const
char
cmd
[
1
]
=
{
0x0D
};
ikbd_write
(
cmd
,
1
);
/* wait for returning bytes */
}
/* Load mouse position */
void
ikbd_mouse_pos_set
(
int
x
,
int
y
)
{
char
cmd
[
6
]
=
{
0x0E
,
0x00
,
x
>>
8
,
x
&
0xFF
,
y
>>
8
,
y
&
0xFF
};
ikbd_write
(
cmd
,
6
);
}
/* Set Y=0 at bottom */
void
ikbd_mouse_y0_bot
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x0F
};
ikbd_write
(
cmd
,
1
);
}
/* Set Y=0 at top */
void
ikbd_mouse_y0_top
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x10
};
ikbd_write
(
cmd
,
1
);
}
/* Resume */
void
ikbd_resume
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x11
};
ikbd_write
(
cmd
,
1
);
}
/* Disable mouse */
void
ikbd_mouse_disable
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x12
};
ikbd_write
(
cmd
,
1
);
}
/* Pause output */
void
ikbd_pause
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x13
};
ikbd_write
(
cmd
,
1
);
}
/* Set joystick event reporting */
void
ikbd_joystick_event_on
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x14
};
ikbd_write
(
cmd
,
1
);
}
/* Set joystick interrogation mode */
void
ikbd_joystick_event_off
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x15
};
ikbd_write
(
cmd
,
1
);
}
/* Joystick interrogation */
void
ikbd_joystick_get_state
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x16
};
ikbd_write
(
cmd
,
1
);
}
#if 0
/* This disables all other ikbd activities !!!! */
/* Set joystick monitoring */
void ikbd_joystick_monitor(int rate)
{
static const char cmd[2] = { 0x17, rate };
ikbd_write(cmd, 2);
kb_state.state = JOYSTICK_MONITOR;
}
#endif
/* some joystick routines not in yet (0x18-0x19) */
/* Disable joysticks */
void
ikbd_joystick_disable
(
void
)
{
static
const
char
cmd
[
1
]
=
{
0x1A
};
ikbd_write
(
cmd
,
1
);
}
/* Time-of-day clock set */
void
ikbd_clock_set
(
int
year
,
int
month
,
int
day
,
int
hour
,
int
minute
,
int
second
)
{
char
cmd
[
7
]
=
{
0x1B
,
year
,
month
,
day
,
hour
,
minute
,
second
};
ikbd_write
(
cmd
,
7
);
}
/* Interrogate time-of-day clock */
void
ikbd_clock_get
(
int
*
year
,
int
*
month
,
int
*
day
,
int
*
hour
,
int
*
minute
,
int
second
)
{
static
const
char
cmd
[
1
]
=
{
0x1C
};
ikbd_write
(
cmd
,
1
);
}
/* Memory load */
void
ikbd_mem_write
(
int
address
,
int
size
,
char
*
data
)
{
panic
(
"Attempt to write data into keyboard memory"
);
}
/* Memory read */
void
ikbd_mem_read
(
int
address
,
char
data
[
6
])
{
char
cmd
[
3
]
=
{
0x21
,
address
>>
8
,
address
&
0xFF
};
ikbd_write
(
cmd
,
3
);
/* receive data and put it in data */
}
/* Controller execute */
void
ikbd_exec
(
int
address
)
{
char
cmd
[
3
]
=
{
0x22
,
address
>>
8
,
address
&
0xFF
};
ikbd_write
(
cmd
,
3
);
}
/* Status inquiries (0x87-0x9A) not yet implemented */
/* Set the state of the caps lock led. */
void
atari_kbd_leds
(
unsigned
int
leds
)
{
char
cmd
[
6
]
=
{
32
,
0
,
4
,
1
,
254
+
((
leds
&
4
)
!=
0
),
0
};
ikbd_write
(
cmd
,
6
);
}
/*
* The original code sometimes left the interrupt line of
* the ACIAs low forever. I hope, it is fixed now.
*
* Martin Rogge, 20 Aug 1995
*/
int
__init
atari_keyb_init
(
void
)
{
/* setup key map */
memcpy
(
key_maps
[
0
],
ataplain_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
1
],
atashift_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
4
],
atactrl_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
5
],
atashift_ctrl_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
8
],
ataalt_map
,
sizeof
(
plain_map
));
/* Atari doesn't have an altgr_map, so we can reuse its memory for
atashift_alt_map */
memcpy
(
key_maps
[
2
],
atashift_alt_map
,
sizeof
(
plain_map
));
key_maps
[
9
]
=
key_maps
[
2
];
key_maps
[
2
]
=
0
;
/* ataaltgr_map */
memcpy
(
key_maps
[
12
],
atactrl_alt_map
,
sizeof
(
plain_map
));
key_maps
[
13
]
=
atashift_ctrl_alt_map
;
keymap_count
=
8
;
/* say that we don't have an AltGr key */
keyboard_type
=
KB_84
;
kb_state
.
state
=
KEYBOARD
;
kb_state
.
len
=
0
;
request_irq
(
IRQ_MFP_ACIA
,
keyboard_interrupt
,
IRQ_TYPE_SLOW
,
"keyboard/mouse/MIDI"
,
keyboard_interrupt
);
atari_turnoff_irq
(
IRQ_MFP_ACIA
);
do
{
/* reset IKBD ACIA */
acia
.
key_ctrl
=
ACIA_RESET
|
(
atari_switches
&
ATARI_SWITCH_IKBD
)
?
ACIA_RHTID
:
0
;
(
void
)
acia
.
key_ctrl
;
(
void
)
acia
.
key_data
;
/* reset MIDI ACIA */
acia
.
mid_ctrl
=
ACIA_RESET
|
(
atari_switches
&
ATARI_SWITCH_MIDI
)
?
ACIA_RHTID
:
0
;
(
void
)
acia
.
mid_ctrl
;
(
void
)
acia
.
mid_data
;
/* divide 500kHz by 64 gives 7812.5 baud */
/* 8 data no parity 1 start 1 stop bit */
/* receive interrupt enabled */
/* RTS low (except if switch selected), transmit interrupt disabled */
acia
.
key_ctrl
=
(
ACIA_DIV64
|
ACIA_D8N1S
|
ACIA_RIE
)
|
((
atari_switches
&
ATARI_SWITCH_IKBD
)
?
ACIA_RHTID
:
ACIA_RLTID
);
acia
.
mid_ctrl
=
ACIA_DIV16
|
ACIA_D8N1S
|
(
atari_switches
&
ATARI_SWITCH_MIDI
)
?
ACIA_RHTID
:
0
;
}
/* make sure the interrupt line is up */
while
((
mfp
.
par_dt_reg
&
0x10
)
==
0
);
/* enable ACIA Interrupts */
mfp
.
active_edge
&=
~
0x10
;
atari_turnon_irq
(
IRQ_MFP_ACIA
);
ikbd_self_test
=
1
;
ikbd_reset
();
/* wait for a period of inactivity (here: 0.25s), then assume the IKBD's
* self-test is finished */
self_test_last_rcv
=
jiffies
;
while
(
time_before
(
jiffies
,
self_test_last_rcv
+
HZ
/
4
))
barrier
();
/* if not incremented: no 0xf1 received */
if
(
ikbd_self_test
==
1
)
printk
(
KERN_ERR
"WARNING: keyboard self test failed!
\n
"
);
ikbd_self_test
=
0
;
ikbd_mouse_disable
();
ikbd_joystick_disable
();
atari_joystick_init
();
return
0
;
}
int
atari_kbdrate
(
struct
kbd_repeat
*
k
)
{
if
(
k
->
delay
>
0
)
{
/* convert from msec to jiffies */
key_repeat_delay
=
(
k
->
delay
*
HZ
+
500
)
/
1000
;
if
(
key_repeat_delay
<
1
)
key_repeat_delay
=
1
;
}
if
(
k
->
rate
>
0
)
{
key_repeat_rate
=
(
k
->
rate
*
HZ
+
500
)
/
1000
;
if
(
key_repeat_rate
<
1
)
key_repeat_rate
=
1
;
}
k
->
delay
=
key_repeat_delay
*
1000
/
HZ
;
k
->
rate
=
key_repeat_rate
*
1000
/
HZ
;
return
(
0
);
}
int
atari_kbd_translate
(
unsigned
char
keycode
,
unsigned
char
*
keycodep
,
char
raw_mode
)
{
#ifdef CONFIG_MAGIC_SYSRQ
/* ALT+HELP pressed? */
if
((
keycode
==
98
)
&&
((
shift_state
&
0xff
)
==
8
))
*
keycodep
=
0xff
;
else
#endif
*
keycodep
=
keycode
;
return
1
;
}
arch/m68k/atari/joystick.c
deleted
100644 → 0
View file @
e8d5b0ba
/*
* Atari Joystick Driver for Linux
* by Robert de Vries (robert@and.nl) 19Jul93
*
* 16 Nov 1994 Andreas Schwab
* Support for three button mouse (shamelessly stolen from MiNT)
* third button wired to one of the joystick directions on joystick 1
*/
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/major.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/smp_lock.h>
#include <asm/atarikb.h>
#include <asm/atari_joystick.h>
#include <asm/uaccess.h>
#define MAJOR_NR JOYSTICK_MAJOR
#define ANALOG_JOY(n) (!(n & 0x80))
#define DIGITAL_JOY(n) (minor(n) & 0x80)
#define DEVICE_NR(n) (minor(n) & 0x7f)
static
struct
joystick_status
joystick
[
2
];
int
atari_mouse_buttons
;
/* for three-button mouse */
void
atari_joystick_interrupt
(
char
*
buf
)
{
int
j
;
/* ikbd_joystick_disable(); */
j
=
buf
[
0
]
&
0x1
;
joystick
[
j
].
dir
=
buf
[
1
]
&
0xF
;
joystick
[
j
].
fire
=
(
buf
[
1
]
&
0x80
)
>>
7
;
joystick
[
j
].
ready
=
1
;
wake_up_interruptible
(
&
joystick
[
j
].
wait
);
/* For three-button mouse emulation fake a mouse packet */
if
(
atari_mouse_interrupt_hook
&&
j
==
1
&&
(
buf
[
1
]
&
1
)
!=
((
atari_mouse_buttons
&
2
)
>>
1
))
{
char
faked_packet
[
3
];
atari_mouse_buttons
=
(
atari_mouse_buttons
&
5
)
|
((
buf
[
1
]
&
1
)
<<
1
);
faked_packet
[
0
]
=
(
atari_mouse_buttons
&
1
)
|
(
atari_mouse_buttons
&
4
?
2
:
0
);
faked_packet
[
1
]
=
0
;
faked_packet
[
2
]
=
0
;
atari_mouse_interrupt_hook
(
faked_packet
);
}
/* ikbd_joystick_event_on(); */
}
static
int
release_joystick
(
struct
inode
*
inode
,
struct
file
*
file
)
{
int
minor
=
DEVICE_NR
(
inode
->
i_rdev
);
joystick
[
minor
].
active
=
0
;
joystick
[
minor
].
ready
=
0
;
if
((
joystick
[
0
].
active
==
0
)
&&
(
joystick
[
1
].
active
==
0
))
ikbd_joystick_disable
();
return
0
;
}
static
int
open_joystick
(
struct
inode
*
inode
,
struct
file
*
file
)
{
int
minor
=
DEVICE_NR
(
inode
->
i_rdev
);
if
(
!
DIGITAL_JOY
(
inode
->
i_rdev
)
||
minor
>
1
)
return
-
ENODEV
;
if
(
joystick
[
minor
].
active
)
return
-
EBUSY
;
joystick
[
minor
].
active
=
1
;
joystick
[
minor
].
ready
=
0
;
ikbd_joystick_event_on
();
return
0
;
}
static
ssize_t
write_joystick
(
struct
file
*
file
,
const
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
return
-
EINVAL
;
}
static
ssize_t
read_joystick
(
struct
file
*
file
,
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
int
minor
=
DEVICE_NR
(
inode
->
i_rdev
);
if
(
count
<
2
)
return
-
EINVAL
;
if
(
!
joystick
[
minor
].
ready
)
return
-
EAGAIN
;
joystick
[
minor
].
ready
=
0
;
if
(
put_user
(
joystick
[
minor
].
fire
,
buffer
++
)
||
put_user
(
joystick
[
minor
].
dir
,
buffer
++
))
return
-
EFAULT
;
if
(
count
>
2
)
if
(
clear_user
(
buffer
,
count
-
2
))
return
-
EFAULT
;
return
count
;
}
static
unsigned
int
joystick_poll
(
struct
file
*
file
,
poll_table
*
wait
)
{
int
minor
=
DEVICE_NR
(
file
->
f_dentry
->
d_inode
->
i_rdev
);
poll_wait
(
file
,
&
joystick
[
minor
].
wait
,
wait
);
if
(
joystick
[
minor
].
ready
)
return
POLLIN
|
POLLRDNORM
;
return
0
;
}
struct
file_operations
atari_joystick_fops
=
{
.
read
=
read_joystick
,
.
write
=
write_joystick
,
.
poll
=
joystick_poll
,
.
open
=
open_joystick
,
.
release
=
release_joystick
,
};
int
__init
atari_joystick_init
(
void
)
{
joystick
[
0
].
active
=
joystick
[
1
].
active
=
0
;
joystick
[
0
].
ready
=
joystick
[
1
].
ready
=
0
;
init_waitqueue_head
(
&
joystick
[
0
].
wait
);
init_waitqueue_head
(
&
joystick
[
1
].
wait
);
if
(
register_chrdev
(
MAJOR_NR
,
"Joystick"
,
&
atari_joystick_fops
))
printk
(
"unable to get major %d for joystick devices
\n
"
,
MAJOR_NR
);
devfs_register_series
(
NULL
,
"joysticks/digital%u"
,
2
,
DEVFS_FL_DEFAULT
,
MAJOR_NR
,
128
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
,
&
atari_joystick_fops
,
NULL
);
return
0
;
}
arch/m68k/hp300/hil.c
deleted
100644 → 0
View file @
e8d5b0ba
/*
* linux/arch/m68k/hp300/hil.c
*
* Copyright (C) 1998 Philip Blundell <philb@gnu.org>
*
* HP300 Human Interface Loop driver. This handles the keyboard and mouse.
*/
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/keyboard.h>
#include <linux/kbd_ll.h>
#include <asm/io.h>
#include <asm/hwtest.h>
#include <asm/ptrace.h>
#include <asm/irq.h>
#include <asm/system.h>
#define HILBASE 0xf0428000
#define HIL_DATA 0x1
#define HIL_CMD 0x3
#define HIL_BUSY 0x02
#define HIL_DATA_RDY 0x01
#define hil_busy() (readb(HILBASE + HIL_CMD) & HIL_BUSY)
#define hil_data_available() (readb(HILBASE + HIL_CMD) & HIL_DATA_RDY)
#define hil_status() (readb(HILBASE + HIL_CMD))
#define hil_command(x) do { writeb((x), HILBASE + HIL_CMD); } while (0)
#define hil_read_data() (readb(HILBASE + HIL_DATA))
#define hil_write_data(x) do { writeb((x), HILBASE + HIL_DATA); } while (0)
#define HIL_SETARD 0xA0
/* set auto-repeat delay */
#define HIL_SETARR 0xA2
/* set auto-repeat rate */
#define HIL_SETTONE 0xA3
/* set tone generator */
#define HIL_CNMT 0xB2
/* clear nmi */
#define HIL_INTON 0x5C
/* Turn on interrupts. */
#define HIL_INTOFF 0x5D
/* Turn off interrupts. */
#define HIL_TRIGGER 0xC5
/* trigger command */
#define HIL_STARTCMD 0xE0
/* start loop command */
#define HIL_TIMEOUT 0xFE
/* timeout */
#define HIL_READTIME 0x13
/* Read real time register */
#define HIL_READBUSY 0x02
/* internal "busy" register */
#define HIL_READKBDLANG 0x12
/* read keyboard language code */
#define HIL_READKBDSADR 0xF9
#define HIL_WRITEKBDSADR 0xE9
#define HIL_READLPSTAT 0xFA
#define HIL_WRITELPSTAT 0xEA
#define HIL_READLPCTRL 0xFB
#define HIL_WRITELPCTRL 0xEB
#define HIL_IRQ 1
#define plain_map hp_plain_map
#define shift_map hp_shift_map
#define altgr_map hp_altgr_map
#define ctrl_map hp_ctrl_map
#define shift_ctrl_map hp_shift_ctrl_map
#define alt_map hp_alt_map
#define ctrl_alt_map hp_ctrl_alt_map
u_short
plain_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf703
,
0xf703
,
0xf700
,
0xf700
,
0xf702
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb62
,
0xfb76
,
0xfb63
,
0xfb78
,
0xfb7a
,
0xf200
,
0xf200
,
0xf01b
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb68
,
0xfb67
,
0xfb66
,
0xfb64
,
0xfb73
,
0xfb61
,
0xf200
,
0xf207
,
0xfb75
,
0xfb79
,
0xfb74
,
0xfb72
,
0xfb65
,
0xfb77
,
0xfb71
,
0xf009
,
0xf037
,
0xf036
,
0xf035
,
0xf034
,
0xf033
,
0xf032
,
0xf031
,
0xf060
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf103
,
0xf102
,
0xf101
,
0xf100
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf200
,
0xf200
,
0xf200
,
0xf038
,
0xf039
,
0xf030
,
0xf02d
,
0xf03d
,
0xf008
,
0xf200
,
0xf200
,
0xfb69
,
0xfb6f
,
0xfb70
,
0xf05b
,
0xf05d
,
0xf05c
,
0xf200
,
0xf200
,
0xfb6a
,
0xfb6b
,
0xfb6c
,
0xf03b
,
0xf027
,
0xf201
,
0xf200
,
0xf200
,
0xfb6d
,
0xf02c
,
0xf02e
,
0xf02f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb6e
,
0xf020
,
0xf200
,
0xf200
,
0xf601
,
0xf600
,
0xf603
,
0xf602
,
};
u_short
shift_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf703
,
0xf703
,
0xf700
,
0xf700
,
0xf702
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb42
,
0xfb56
,
0xfb43
,
0xfb58
,
0xfb5a
,
0xf200
,
0xf200
,
0xf07f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb48
,
0xfb47
,
0xfb46
,
0xfb44
,
0xfb53
,
0xfb41
,
0xf200
,
0xf207
,
0xfb55
,
0xfb59
,
0xfb54
,
0xfb52
,
0xfb45
,
0xfb57
,
0xfb51
,
0xf009
,
0xf026
,
0xf05e
,
0xf025
,
0xf024
,
0xf023
,
0xf040
,
0xf021
,
0xf07e
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf103
,
0xf102
,
0xf101
,
0xf100
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf200
,
0xf200
,
0xf200
,
0xf02a
,
0xf028
,
0xf029
,
0xf05f
,
0xf02b
,
0xf200
,
0xf200
,
0xf200
,
0xfb49
,
0xfb4f
,
0xfb50
,
0xf07b
,
0xf07d
,
0xf07c
,
0xf200
,
0xf200
,
0xfb4a
,
0xfb4b
,
0xfb4c
,
0xf03a
,
0xf022
,
0xf201
,
0xf200
,
0xf200
,
0xfb4d
,
0xf03c
,
0xf03e
,
0xf03f
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb4e
,
0xf020
,
0xf200
,
0xf200
,
0xf601
,
0xf600
,
0xf603
,
0xf602
,
};
u_short
altgr_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf703
,
0xf703
,
0xf700
,
0xf700
,
0xf702
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb62
,
0xfb76
,
0xfb63
,
0xfb78
,
0xfb7a
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb68
,
0xfb67
,
0xfb66
,
0xfb64
,
0xfb73
,
0xfb61
,
0xf200
,
0xf207
,
0xfb75
,
0xfb79
,
0xfb74
,
0xfb72
,
0xfb65
,
0xfb77
,
0xfb71
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf040
,
0xf021
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf103
,
0xf102
,
0xf101
,
0xf100
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf200
,
0xf200
,
0xf200
,
0xf02a
,
0xf05b
,
0xf05d
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb69
,
0xfb6f
,
0xfb70
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb6a
,
0xfb6b
,
0xfb6c
,
0xf200
,
0xf200
,
0xf201
,
0xf200
,
0xf200
,
0xfb6d
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xfb6e
,
0xf200
,
0xf200
,
0xf200
,
0xf601
,
0xf600
,
0xf603
,
0xf602
,
};
u_short
ctrl_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf703
,
0xf703
,
0xf700
,
0xf700
,
0xf702
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf002
,
0xf016
,
0xf003
,
0xf018
,
0xf01a
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf008
,
0xf007
,
0xf006
,
0xf004
,
0xf013
,
0xf001
,
0xf200
,
0xf207
,
0xf015
,
0xf019
,
0xf014
,
0xf012
,
0xf005
,
0xf017
,
0xf011
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf000
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf503
,
0xf502
,
0xf501
,
0xf500
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf504
,
0xf505
,
0xf506
,
0xf507
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf009
,
0xf00f
,
0xf010
,
0xf200
,
0xf200
,
0xf01c
,
0xf200
,
0xf200
,
0xf00a
,
0xf00b
,
0xf00c
,
0xf200
,
0xf007
,
0xf201
,
0xf200
,
0xf200
,
0xf00d
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf00e
,
0xf200
,
0xf200
,
0xf200
,
0xf601
,
0xf600
,
0xf603
,
0xf602
,
};
u_short
shift_ctrl_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf703
,
0xf703
,
0xf700
,
0xf700
,
0xf702
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf002
,
0xf016
,
0xf003
,
0xf018
,
0xf01a
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf008
,
0xf007
,
0xf006
,
0xf004
,
0xf013
,
0xf001
,
0xf200
,
0xf207
,
0xf015
,
0xf019
,
0xf014
,
0xf012
,
0xf005
,
0xf017
,
0xf011
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf103
,
0xf102
,
0xf101
,
0xf100
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf009
,
0xf00f
,
0xf010
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf00a
,
0xf00b
,
0xf00c
,
0xf200
,
0xf200
,
0xf201
,
0xf200
,
0xf200
,
0xf00d
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf00e
,
0xf200
,
0xf200
,
0xf200
,
0xf601
,
0xf600
,
0xf603
,
0xf602
,
};
u_short
alt_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf703
,
0xf703
,
0xf700
,
0xf700
,
0xf702
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf862
,
0xf876
,
0xf863
,
0xf878
,
0xf87a
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf868
,
0xf867
,
0xf866
,
0xf864
,
0xf873
,
0xf861
,
0xf200
,
0xf207
,
0xf875
,
0xf879
,
0xf874
,
0xf872
,
0xf865
,
0xf877
,
0xf871
,
0xf809
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf860
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf103
,
0xf102
,
0xf101
,
0xf100
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf869
,
0xf86f
,
0xf870
,
0xf200
,
0xf200
,
0xf85c
,
0xf200
,
0xf200
,
0xf86a
,
0xf86b
,
0xf86c
,
0xf83b
,
0xf827
,
0xf201
,
0xf200
,
0xf200
,
0xf86d
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf86e
,
0xf200
,
0xf200
,
0xf200
,
0xf601
,
0xf600
,
0xf603
,
0xf602
,
};
u_short
ctrl_alt_map
[
NR_KEYS
]
=
{
0xf200
,
0xf200
,
0xf703
,
0xf703
,
0xf700
,
0xf700
,
0xf702
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf802
,
0xf816
,
0xf803
,
0xf818
,
0xf81a
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf808
,
0xf807
,
0xf806
,
0xf804
,
0xf813
,
0xf801
,
0xf200
,
0xf207
,
0xf815
,
0xf819
,
0xf814
,
0xf812
,
0xf805
,
0xf817
,
0xf811
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf103
,
0xf102
,
0xf101
,
0xf100
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf809
,
0xf80f
,
0xf810
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf80a
,
0xf80b
,
0xf80c
,
0xf200
,
0xf200
,
0xf201
,
0xf200
,
0xf200
,
0xf80d
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf80e
,
0xf200
,
0xf200
,
0xf200
,
0xf601
,
0xf600
,
0xf603
,
0xf602
,
};
#undef plain_map
#undef ctrl_alt_map
#undef shift_map
#undef altgr_map
#undef ctrl_map
#undef shift_ctrl_map
#undef alt_map
struct
{
unsigned
char
s
,
c
;
int
valid
;
}
hil_last
;
#define hil_getlast(s,c) do { s = hil_last.s; c = hil_last.c; hil_last.valid = 0; } while (0)
struct
{
unsigned
char
data
[
16
];
unsigned
int
ptr
;
}
poll
;
unsigned
char
curdev
=
0
;
static
void
poll_finished
(
void
)
{
switch
(
poll
.
data
[
0
])
{
case
0x40
:
{
int
down
=
(
poll
.
data
[
1
]
&
1
)
==
0
;
unsigned
char
scode
=
poll
.
data
[
1
]
>>
1
;
#if 0
if (down)
printk("[%02x]", scode);
#endif
handle_scancode
(
scode
,
down
);
}
break
;
}
curdev
=
0
;
}
static
inline
void
handle_status
(
unsigned
char
s
,
unsigned
char
c
)
{
if
(
c
&
0x8
)
{
/* End of block */
if
(
c
&
0x10
)
poll_finished
();
}
else
{
if
(
c
&
0x10
)
{
if
(
curdev
)
poll_finished
();
/* just in case */
curdev
=
c
&
7
;
poll
.
ptr
=
0
;
}
}
}
static
inline
void
handle_data
(
unsigned
char
s
,
unsigned
char
c
)
{
if
(
curdev
)
poll
.
data
[
poll
.
ptr
++
]
=
c
;
}
/*
* Handle HIL interrupts.
*/
static
void
hil_interrupt
(
int
irq
,
void
*
handle
,
struct
pt_regs
*
regs
)
{
unsigned
char
s
,
c
;
s
=
hil_status
();
c
=
hil_read_data
();
switch
(
s
>>
4
)
{
case
0x5
:
handle_status
(
s
,
c
);
break
;
case
0x6
:
handle_data
(
s
,
c
);
break
;
case
0x4
:
hil_last
.
s
=
s
;
hil_last
.
c
=
c
;
mb
();
hil_last
.
valid
=
1
;
break
;
}
}
/*
* Send a command to the HIL
*/
static
void
hil_do
(
unsigned
char
cmd
,
unsigned
char
*
data
,
unsigned
int
len
)
{
unsigned
long
flags
;
save_flags
(
flags
);
cli
();
while
(
hil_busy
());
hil_command
(
cmd
);
while
(
len
--
)
{
while
(
hil_busy
());
hil_write_data
(
*
(
data
++
));
}
restore_flags
(
flags
);
}
/*
* Initialise HIL.
*/
int
__init
hp300_keyb_init
(
void
)
{
unsigned
char
s
,
c
,
kbid
;
unsigned
int
n
=
0
;
memcpy
(
key_maps
[
0
],
hp_plain_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
1
],
hp_shift_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
4
],
hp_ctrl_map
,
sizeof
(
plain_map
));
if
(
!
hwreg_present
((
void
*
)(
HILBASE
+
HIL_DATA
)))
return
1
;
/* maybe this can happen */
request_irq
(
HIL_IRQ
,
hil_interrupt
,
0
,
"HIL"
,
NULL
);
/* Turn on interrupts */
hil_do
(
HIL_INTON
,
NULL
,
0
);
/* Look for keyboards */
hil_do
(
HIL_READKBDSADR
,
NULL
,
0
);
while
(
!
hil_last
.
valid
)
{
if
(
n
++
>
100000
)
{
printk
(
"HIL: timed out, assuming no keyboard present.
\n
"
);
return
1
;
}
mb
();
}
hil_getlast
(
s
,
c
);
if
(
c
==
0
)
{
printk
(
"HIL: no keyboard present.
\n
"
);
return
1
;
}
for
(
kbid
=
0
;
(
kbid
<
8
)
&&
((
c
&
(
1
<<
kbid
))
==
0
);
kbid
++
);
printk
(
"HIL: keyboard found at id %d
\n
"
,
kbid
);
/* set it to raw mode */
c
=
0
;
hil_do
(
HIL_WRITEKBDSADR
,
&
c
,
1
);
return
0
;
}
drivers/char/amikeyb.c
deleted
100644 → 0
View file @
e8d5b0ba
/*
* linux/arch/m68k/amiga/amikeyb.c
*
* Amiga Keyboard driver for Linux/m68k
*
* 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.
*/
/*
* Amiga support by Hamish Macdonald
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/keyboard.h>
#include <linux/kd.h>
#include <linux/kbd_ll.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/random.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/kbd_kern.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
#include <asm/irq.h>
#define AMIKEY_CAPS (0x62)
#define BREAK_MASK (0x80)
#define RESET_WARNING (0xf0)
/* before rotation */
static
u_short
amiplain_map
[
NR_KEYS
]
__initdata
=
{
0xf060
,
0xf031
,
0xf032
,
0xf033
,
0xf034
,
0xf035
,
0xf036
,
0xf037
,
0xf038
,
0xf039
,
0xf030
,
0xf02d
,
0xf03d
,
0xf05c
,
0xf200
,
0xf300
,
0xfb71
,
0xfb77
,
0xfb65
,
0xfb72
,
0xfb74
,
0xfb79
,
0xfb75
,
0xfb69
,
0xfb6f
,
0xfb70
,
0xf05b
,
0xf05d
,
0xf200
,
0xf301
,
0xf302
,
0xf303
,
0xfb61
,
0xfb73
,
0xfb64
,
0xfb66
,
0xfb67
,
0xfb68
,
0xfb6a
,
0xfb6b
,
0xfb6c
,
0xf03b
,
0xf027
,
0xf200
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
0xf200
,
0xfb7a
,
0xfb78
,
0xfb63
,
0xfb76
,
0xfb62
,
0xfb6e
,
0xfb6d
,
0xf02c
,
0xf02e
,
0xf02f
,
0xf200
,
0xf310
,
0xf307
,
0xf308
,
0xf309
,
0xf020
,
0xf07f
,
0xf009
,
0xf30e
,
0xf201
,
0xf01b
,
0xf07f
,
0xf200
,
0xf200
,
0xf200
,
0xf30b
,
0xf200
,
0xf603
,
0xf600
,
0xf602
,
0xf601
,
0xf100
,
0xf101
,
0xf102
,
0xf103
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf108
,
0xf109
,
0xf312
,
0xf313
,
0xf30d
,
0xf30c
,
0xf30a
,
0xf11b
,
0xf700
,
0xf700
,
0xf207
,
0xf702
,
0xf703
,
0xf701
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
amishift_map
[
NR_KEYS
]
__initdata
=
{
0xf07e
,
0xf021
,
0xf040
,
0xf023
,
0xf024
,
0xf025
,
0xf05e
,
0xf026
,
0xf02a
,
0xf028
,
0xf029
,
0xf05f
,
0xf02b
,
0xf07c
,
0xf200
,
0xf300
,
0xfb51
,
0xfb57
,
0xfb45
,
0xfb52
,
0xfb54
,
0xfb59
,
0xfb55
,
0xfb49
,
0xfb4f
,
0xfb50
,
0xf07b
,
0xf07d
,
0xf200
,
0xf301
,
0xf302
,
0xf303
,
0xfb41
,
0xfb53
,
0xfb44
,
0xfb46
,
0xfb47
,
0xfb48
,
0xfb4a
,
0xfb4b
,
0xfb4c
,
0xf03a
,
0xf022
,
0xf200
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
0xf200
,
0xfb5a
,
0xfb58
,
0xfb43
,
0xfb56
,
0xfb42
,
0xfb4e
,
0xfb4d
,
0xf03c
,
0xf03e
,
0xf03f
,
0xf200
,
0xf310
,
0xf307
,
0xf308
,
0xf309
,
0xf020
,
0xf07f
,
0xf009
,
0xf30e
,
0xf201
,
0xf01b
,
0xf07f
,
0xf200
,
0xf200
,
0xf200
,
0xf30b
,
0xf200
,
0xf603
,
0xf600
,
0xf602
,
0xf601
,
0xf10a
,
0xf10b
,
0xf10c
,
0xf10d
,
0xf10e
,
0xf10f
,
0xf110
,
0xf111
,
0xf112
,
0xf113
,
0xf208
,
0xf209
,
0xf30d
,
0xf30c
,
0xf30a
,
0xf203
,
0xf700
,
0xf700
,
0xf207
,
0xf702
,
0xf703
,
0xf701
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
amialtgr_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf040
,
0xf200
,
0xf024
,
0xf200
,
0xf200
,
0xf07b
,
0xf05b
,
0xf05d
,
0xf07d
,
0xf05c
,
0xf200
,
0xf200
,
0xf200
,
0xf300
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf07e
,
0xf200
,
0xf301
,
0xf302
,
0xf303
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf310
,
0xf307
,
0xf308
,
0xf309
,
0xf200
,
0xf07f
,
0xf200
,
0xf30e
,
0xf201
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf30b
,
0xf200
,
0xf603
,
0xf600
,
0xf602
,
0xf601
,
0xf50c
,
0xf50d
,
0xf50e
,
0xf50f
,
0xf510
,
0xf511
,
0xf512
,
0xf513
,
0xf514
,
0xf515
,
0xf208
,
0xf209
,
0xf30d
,
0xf30c
,
0xf30a
,
0xf204
,
0xf700
,
0xf700
,
0xf207
,
0xf702
,
0xf703
,
0xf701
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
amictrl_map
[
NR_KEYS
]
__initdata
=
{
0xf000
,
0xf200
,
0xf000
,
0xf01b
,
0xf01c
,
0xf01d
,
0xf01e
,
0xf01f
,
0xf07f
,
0xf200
,
0xf200
,
0xf01f
,
0xf200
,
0xf01c
,
0xf200
,
0xf300
,
0xf011
,
0xf017
,
0xf005
,
0xf012
,
0xf014
,
0xf019
,
0xf015
,
0xf009
,
0xf00f
,
0xf010
,
0xf01b
,
0xf01d
,
0xf200
,
0xf301
,
0xf302
,
0xf303
,
0xf001
,
0xf013
,
0xf004
,
0xf006
,
0xf007
,
0xf008
,
0xf00a
,
0xf00b
,
0xf00c
,
0xf200
,
0xf007
,
0xf200
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
0xf200
,
0xf01a
,
0xf018
,
0xf003
,
0xf016
,
0xf002
,
0xf00e
,
0xf00d
,
0xf200
,
0xf200
,
0xf07f
,
0xf200
,
0xf310
,
0xf307
,
0xf308
,
0xf309
,
0xf000
,
0xf07f
,
0xf200
,
0xf30e
,
0xf201
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf30b
,
0xf200
,
0xf603
,
0xf600
,
0xf602
,
0xf601
,
0xf100
,
0xf101
,
0xf102
,
0xf103
,
0xf104
,
0xf105
,
0xf106
,
0xf107
,
0xf108
,
0xf109
,
0xf208
,
0xf209
,
0xf30d
,
0xf30c
,
0xf30a
,
0xf202
,
0xf700
,
0xf700
,
0xf207
,
0xf702
,
0xf703
,
0xf701
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
amishift_ctrl_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf300
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf301
,
0xf302
,
0xf303
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf310
,
0xf307
,
0xf308
,
0xf309
,
0xf200
,
0xf07f
,
0xf200
,
0xf30e
,
0xf201
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf30b
,
0xf200
,
0xf603
,
0xf600
,
0xf602
,
0xf601
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf208
,
0xf209
,
0xf30d
,
0xf30c
,
0xf30a
,
0xf200
,
0xf700
,
0xf700
,
0xf207
,
0xf702
,
0xf703
,
0xf701
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
amialt_map
[
NR_KEYS
]
__initdata
=
{
0xf860
,
0xf831
,
0xf832
,
0xf833
,
0xf834
,
0xf835
,
0xf836
,
0xf837
,
0xf838
,
0xf839
,
0xf830
,
0xf82d
,
0xf83d
,
0xf85c
,
0xf200
,
0xf900
,
0xf871
,
0xf877
,
0xf865
,
0xf872
,
0xf874
,
0xf879
,
0xf875
,
0xf869
,
0xf86f
,
0xf870
,
0xf85b
,
0xf85d
,
0xf200
,
0xf901
,
0xf902
,
0xf903
,
0xf861
,
0xf873
,
0xf864
,
0xf866
,
0xf867
,
0xf868
,
0xf86a
,
0xf86b
,
0xf86c
,
0xf83b
,
0xf827
,
0xf200
,
0xf200
,
0xf904
,
0xf905
,
0xf906
,
0xf200
,
0xf87a
,
0xf878
,
0xf863
,
0xf876
,
0xf862
,
0xf86e
,
0xf86d
,
0xf82c
,
0xf82e
,
0xf82f
,
0xf200
,
0xf310
,
0xf907
,
0xf908
,
0xf909
,
0xf820
,
0xf87f
,
0xf809
,
0xf30e
,
0xf80d
,
0xf81b
,
0xf87f
,
0xf200
,
0xf200
,
0xf200
,
0xf30b
,
0xf200
,
0xf603
,
0xf600
,
0xf602
,
0xf601
,
0xf500
,
0xf501
,
0xf502
,
0xf503
,
0xf504
,
0xf505
,
0xf506
,
0xf507
,
0xf508
,
0xf509
,
0xf208
,
0xf209
,
0xf30d
,
0xf30c
,
0xf30a
,
0xf204
,
0xf700
,
0xf700
,
0xf207
,
0xf702
,
0xf703
,
0xf701
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
amictrl_alt_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf300
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf301
,
0xf302
,
0xf303
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf20c
,
0xf307
,
0xf308
,
0xf309
,
0xf200
,
0xf07f
,
0xf200
,
0xf30e
,
0xf201
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf30b
,
0xf200
,
0xf603
,
0xf600
,
0xf602
,
0xf601
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf208
,
0xf209
,
0xf30d
,
0xf30c
,
0xf30a
,
0xf200
,
0xf700
,
0xf700
,
0xf207
,
0xf702
,
0xf703
,
0xf701
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
};
#define DEFAULT_KEYB_REP_DELAY (HZ/4)
#define DEFAULT_KEYB_REP_RATE (HZ/25)
/* These could be settable by some ioctl() in future... */
static
unsigned
int
key_repeat_delay
=
DEFAULT_KEYB_REP_DELAY
;
static
unsigned
int
key_repeat_rate
=
DEFAULT_KEYB_REP_RATE
;
static
unsigned
char
rep_scancode
;
static
void
amikeyb_rep
(
unsigned
long
ignore
);
static
struct
timer_list
amikeyb_rep_timer
=
{
function
:
amikeyb_rep
};
static
void
amikeyb_rep
(
unsigned
long
ignore
)
{
unsigned
long
flags
;
save_flags
(
flags
);
cli
();
kbd_pt_regs
=
NULL
;
amikeyb_rep_timer
.
expires
=
jiffies
+
key_repeat_rate
;
add_timer
(
&
amikeyb_rep_timer
);
handle_scancode
(
rep_scancode
,
1
);
restore_flags
(
flags
);
}
static
void
keyboard_interrupt
(
int
irq
,
void
*
dummy
,
struct
pt_regs
*
fp
)
{
unsigned
char
scancode
,
break_flag
,
keycode
;
static
int
reset_warning
=
0
;
/* save frame for register dump */
kbd_pt_regs
=
fp
;
/* get and invert scancode (keyboard is active low) */
scancode
=
~
ciaa
.
sdr
;
/* switch SP pin to output for handshake */
ciaa
.
cra
|=
0x40
;
#if 0 /* No longer used */
/*
* On receipt of the second RESET_WARNING, we must not pull KDAT high
* again to delay the hard reset as long as possible.
*
* Note that not all keyboards send reset warnings...
*/
if (reset_warning)
if (scancode == RESET_WARNING) {
printk(KERN_ALERT "amikeyb: Ctrl-Amiga-Amiga reset warning!!\n"
"The system will be reset within 10 seconds!!\n");
/* Panic doesn't sync from within an interrupt, so we do nothing */
return;
} else
/* Probably a mistake, cancel the alert */
reset_warning = 0;
#endif
/* wait until 85 us have expired */
udelay
(
85
);
/* switch CIA serial port to input mode */
ciaa
.
cra
&=
~
0x40
;
tasklet_schedule
(
&
keyboard_tasklet
);
/* rotate scan code to get up/down bit in proper position */
scancode
=
((
scancode
>>
1
)
&
0x7f
)
|
((
scancode
<<
7
)
&
0x80
);
/*
* Check make/break first
*/
break_flag
=
scancode
&
BREAK_MASK
;
keycode
=
scancode
&
(
unsigned
char
)
~
BREAK_MASK
;
if
(
keycode
==
AMIKEY_CAPS
)
{
/* if the key is CAPS, fake a press/release. */
handle_scancode
(
AMIKEY_CAPS
,
1
);
handle_scancode
(
AMIKEY_CAPS
,
0
);
}
else
if
(
keycode
<
0x78
)
{
/* handle repeat */
if
(
break_flag
)
{
del_timer
(
&
amikeyb_rep_timer
);
rep_scancode
=
0
;
}
else
{
del_timer
(
&
amikeyb_rep_timer
);
rep_scancode
=
keycode
;
amikeyb_rep_timer
.
expires
=
jiffies
+
key_repeat_delay
;
add_timer
(
&
amikeyb_rep_timer
);
}
handle_scancode
(
keycode
,
!
break_flag
);
}
else
switch
(
keycode
)
{
case
0x78
:
reset_warning
=
1
;
break
;
case
0x79
:
printk
(
KERN_WARNING
"amikeyb: keyboard lost sync
\n
"
);
break
;
case
0x7a
:
printk
(
KERN_WARNING
"amikeyb: keyboard buffer overflow
\n
"
);
break
;
#if 0 /* obsolete according to the HRM */
case 0x7b:
printk(KERN_WARNING "amikeyb: keyboard controller failure\n");
break;
#endif
case
0x7c
:
printk
(
KERN_ERR
"amikeyb: keyboard selftest failure
\n
"
);
break
;
case
0x7d
:
printk
(
KERN_INFO
"amikeyb: initiate power-up key stream
\n
"
);
break
;
case
0x7e
:
printk
(
KERN_INFO
"amikeyb: terminate power-up key stream
\n
"
);
break
;
#if 0 /* obsolete according to the HRM */
case 0x7f:
printk(KERN_WARNING "amikeyb: keyboard interrupt\n");
break;
#endif
default:
printk
(
KERN_WARNING
"amikeyb: unknown keyboard communication code 0x%02x
\n
"
,
scancode
);
break
;
}
}
int
__init
amiga_keyb_init
(
void
)
{
if
(
!
AMIGAHW_PRESENT
(
AMI_KEYBOARD
))
return
-
EIO
;
if
(
!
request_mem_region
(
CIAA_PHYSADDR
-
1
+
0xb00
,
0x100
,
"amikeyb"
))
return
-
EBUSY
;
/* setup key map */
memcpy
(
key_maps
[
0
],
amiplain_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
1
],
amishift_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
2
],
amialtgr_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
4
],
amictrl_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
5
],
amishift_ctrl_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
8
],
amialt_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
12
],
amictrl_alt_map
,
sizeof
(
plain_map
));
/*
* Initialize serial data direction.
*/
ciaa
.
cra
&=
~
0x41
;
/* serial data in, turn off TA */
/*
* arrange for processing of keyboard interrupt
*/
request_irq
(
IRQ_AMIGA_CIAA_SP
,
keyboard_interrupt
,
0
,
"keyboard"
,
NULL
);
return
0
;
}
int
amiga_kbdrate
(
struct
kbd_repeat
*
k
)
{
if
(
k
->
delay
>
0
)
{
/* convert from msec to jiffies */
key_repeat_delay
=
(
k
->
delay
*
HZ
+
500
)
/
1000
;
if
(
key_repeat_delay
<
1
)
key_repeat_delay
=
1
;
}
if
(
k
->
rate
>
0
)
{
key_repeat_rate
=
(
k
->
rate
*
HZ
+
500
)
/
1000
;
if
(
key_repeat_rate
<
1
)
key_repeat_rate
=
1
;
}
k
->
delay
=
key_repeat_delay
*
1000
/
HZ
;
k
->
rate
=
key_repeat_rate
*
1000
/
HZ
;
return
(
0
);
}
int
amiga_kbd_translate
(
unsigned
char
keycode
,
unsigned
char
*
keycodep
,
char
raw_mode
)
{
#ifdef CONFIG_MAGIC_SYSRQ
/* SHIFT+ALTGR+HELP pressed? */
if
((
keycode
==
0x5f
)
&&
((
shift_state
&
0xff
)
==
3
))
*
keycodep
=
0xff
;
else
#endif
*
keycodep
=
keycode
;
return
1
;
}
drivers/char/atarimouse.c
deleted
100644 → 0
View file @
e8d5b0ba
/*
* Atari Mouse Driver for Linux
* by Robert de Vries (robert@and.nl) 19Jul93
*
* 16 Nov 1994 Andreas Schwab
* Compatibility with busmouse
* Support for three button mouse (shamelessly stolen from MiNT)
* third button wired to one of the joystick directions on joystick 1
*
* 1996/02/11 Andreas Schwab
* Module support
* Allow multiple open's
*
* Converted to use new generic busmouse code. 5 Apr 1998
* Russell King <rmk@arm.uk.linux.org>
*/
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/miscdevice.h>
#include <linux/mm.h>
#include <linux/random.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/logibusmouse.h>
#include <asm/setup.h>
#include <asm/atarikb.h>
#include <asm/uaccess.h>
#include "busmouse.h"
static
int
msedev
;
static
int
mouse_threshold
[
2
]
=
{
2
,
2
};
MODULE_PARM
(
mouse_threshold
,
"2i"
);
extern
int
atari_mouse_buttons
;
static
void
atari_mouse_interrupt
(
char
*
buf
)
{
int
buttons
;
/* ikbd_mouse_disable(); */
buttons
=
((
buf
[
0
]
&
1
)
|
((
buf
[
0
]
&
2
)
<<
1
)
|
(
atari_mouse_buttons
&
2
));
atari_mouse_buttons
=
buttons
;
busmouse_add_movementbuttons
(
msedev
,
buf
[
1
],
-
buf
[
2
],
buttons
^
7
);
/* ikbd_mouse_rel_pos(); */
}
static
int
release_mouse
(
struct
inode
*
inode
,
struct
file
*
file
)
{
ikbd_mouse_disable
();
atari_mouse_interrupt_hook
=
NULL
;
return
0
;
}
static
int
open_mouse
(
struct
inode
*
inode
,
struct
file
*
file
)
{
atari_mouse_buttons
=
0
;
ikbd_mouse_y0_top
();
ikbd_mouse_thresh
(
mouse_threshold
[
0
],
mouse_threshold
[
1
]);
ikbd_mouse_rel_pos
();
atari_mouse_interrupt_hook
=
atari_mouse_interrupt
;
return
0
;
}
static
struct
busmouse
atarimouse
=
{
ATARIMOUSE_MINOR
,
"atarimouse"
,
THIS_MODULE
,
open_mouse
,
release_mouse
,
0
};
static
int
__init
atari_mouse_init
(
void
)
{
if
(
!
MACH_IS_ATARI
)
return
-
ENODEV
;
msedev
=
register_busmouse
(
&
atarimouse
);
if
(
msedev
<
0
)
printk
(
KERN_WARNING
"Unable to register Atari mouse driver.
\n
"
);
else
printk
(
KERN_INFO
"Atari mouse installed.
\n
"
);
return
msedev
<
0
?
msedev
:
0
;
}
#ifndef MODULE
#define MIN_THRESHOLD 1
#define MAX_THRESHOLD 20
/* more seems not reasonable... */
static
int
__init
atari_mouse_setup
(
char
*
str
)
{
int
ints
[
8
];
str
=
get_options
(
str
,
ARRAY_SIZE
(
ints
),
ints
);
if
(
ints
[
0
]
<
1
)
{
printk
(
KERN_ERR
"atari_mouse_setup: no arguments!
\n
"
);
return
0
;
}
else
if
(
ints
[
0
]
>
2
)
{
printk
(
KERN_WARNING
"atari_mouse_setup: too many arguments
\n
"
);
}
if
(
ints
[
1
]
<
MIN_THRESHOLD
||
ints
[
1
]
>
MAX_THRESHOLD
)
printk
(
KERN_WARNING
"atari_mouse_setup: bad threshold value (ignored)
\n
"
);
else
{
mouse_threshold
[
0
]
=
ints
[
1
];
mouse_threshold
[
1
]
=
ints
[
1
];
if
(
ints
[
0
]
>
1
)
{
if
(
ints
[
2
]
<
MIN_THRESHOLD
||
ints
[
2
]
>
MAX_THRESHOLD
)
printk
(
KERN_WARNING
"atari_mouse_setup: bad threshold value (ignored)
\n
"
);
else
mouse_threshold
[
1
]
=
ints
[
2
];
}
}
return
1
;
}
__setup
(
"atarimouse="
,
atari_mouse_setup
);
#endif
/* !MODULE */
static
void
__exit
atari_mouse_cleanup
(
void
)
{
unregister_busmouse
(
msedev
);
}
module_init
(
atari_mouse_init
);
module_exit
(
atari_mouse_cleanup
);
MODULE_LICENSE
(
"GPL"
);
\ No newline at end of file
drivers/char/dn_keyb.c
deleted
100644 → 0
View file @
e8d5b0ba
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/keyboard.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/kd.h>
#include <linux/kbd_ll.h>
#include <linux/random.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/miscdevice.h>
#include <linux/init.h>
#include <asm/setup.h>
#include <asm/irq.h>
#include <asm/apollohw.h>
#include <asm/uaccess.h>
#include "busmouse.h"
#define DNKEY_CAPS 0x7e
#define BREAK_FLAG 0x80
#define DNKEY_REPEAT_DELAY 50
#define DNKEY_CTRL 0x43
#define DNKEY_LSHIFT 0x5e
#define DNKEY_RSHIFT 0x6a
#define DNKEY_REPT 0x5d
#define DNKEY_REPEAT 0x7f
#define DNKEY_LALT 0x75
#define DNKEY_RALT 0x77
#define APOLLO_KEYB_CMD_ENTRIES 16
#define APOLLO_KBD_MODE_KEYB 0x01
#define APOLLO_KBD_MODE_MOUSE 0x02
#define APOLLO_KBD_MODE_CHANGE 0xff
static
u_char
keyb_cmds
[
APOLLO_KEYB_CMD_ENTRIES
];
static
short
keyb_cmd_read
=
0
,
keyb_cmd_write
=
0
;
static
int
keyb_cmd_transmit
=
0
;
static
int
msedev
;
static
unsigned
int
kbd_mode
=
APOLLO_KBD_MODE_KEYB
;
#if 0
static void debug_keyb_timer_handler(unsigned long ignored);
static u_char debug_buf1[4096],debug_buf2[4096],*debug_buf=&debug_buf1[0];
static u_char *shadow_buf=&debug_buf2[0];
static short debug_buf_count=0;
static int debug_buf_overrun=0,debug_timer_running=0;
static unsigned long debug_buffer_updated=0;
static struct timer_list debug_keyb_timer = { function: debug_keyb_timer_handler };
#endif
static
u_short
dnplain_map
[
NR_KEYS
]
__initdata
=
{
/* ins del del F1 F2 F3 F4
mark line char */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
/* Edit Exit Hold Copy Paste Grow ESC */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf01b
,
/* 1 2 3 4 5 6 7 8 */
0xf031
,
0xf032
,
0xf033
,
0xf034
,
0xf035
,
0xf036
,
0xf037
,
0xf038
,
/* 9 0 - = ` Back |<--
Space */
0xf039
,
0xf030
,
0xf02d
,
0xf03d
,
0xf060
,
0xf07f
,
0xf200
,
0xf200
,
/* Shell -->| Tab q w e
Cmd */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf009
,
0xfb71
,
0xfb77
,
0xfb65
,
/* r t y u i o p [ */
0xfb72
,
0xfb74
,
0xfb79
,
0xfb75
,
0xfb69
,
0xfb6f
,
0xfb70
,
0xf05b
,
/* ] Del 7 8 9 + */
0xf05d
,
0xf200
,
0xf200
,
0xf200
,
0xf307
,
0xf308
,
0xf300
,
0xf30a
,
/* [<--] Up [-->] Ctrl a s */
0xf200
,
0xf600
,
0xf200
,
0xf702
,
0xf200
,
0xf200
,
0xfb61
,
0xfb73
,
/* d f g h j k l ; */
0xfb64
,
0xfb66
,
0xfb67
,
0xfb68
,
0xfb6a
,
0xfb6b
,
0xfb6c
,
0xf03b
,
/* ' Return \ 4 5 6 */
0xf027
,
0xf200
,
0xf201
,
0xf05c
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
/* - <-- Next --> Rept Shift
Window */
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf200
,
0xf200
,
0xf700
,
0xf200
,
/* z x c v b n m , */
0xfb7a
,
0xfb78
,
0xfb63
,
0xfb76
,
0xfb62
,
0xfb6e
,
0xfb6d
,
0xf02c
,
/* . / Shift Pop 1 2 */
0xf02e
,
0xf02f
,
0xf700
,
0xf200
,
0xf200
,
0xf200
,
0xf301
,
0xf302
,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303
,
0xf200
,
0xf118
,
0xf603
,
0xf119
,
0xf703
,
0xf020
,
0xf701
,
/* 0 . Enter */
0xf200
,
0xf300
,
0xf200
,
0xf310
,
0xf30e
,
0xf200
,
0xf700
,
0xf200
,
};
static
u_short
dnshift_map
[
NR_KEYS
]
__initdata
=
{
/* ins del del F1 F2 F3 F4
mark line char */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
/* Save Abort Help Cut Undo Grow ESC */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf01b
,
/* ! @ # $ % ^ & * */
0xf021
,
0xf040
,
0xf023
,
0xf024
,
0xf025
,
0xf05e
,
0xf026
,
0xf02a
,
/* ( ) _ + ~ Back |<--
Space */
0xf028
,
0xf029
,
0xf05f
,
0xf02b
,
0xf07e
,
0xf07f
,
0xf200
,
0xf200
,
/* Shell -->| Tab Q W E
Cmd */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf009
,
0xfb51
,
0xfb57
,
0xfb45
,
/* R T Y U I O P { */
0xfb52
,
0xfb54
,
0xfb59
,
0xfb55
,
0xfb49
,
0xfb4f
,
0xfb50
,
0xf07b
,
/* } Del 7 8 9 + */
0xf07d
,
0xf200
,
0xf200
,
0xf200
,
0xf307
,
0xf308
,
0xf300
,
0xf30a
,
/* [<--] Up [-->] Ctrl A S */
0xf200
,
0xf600
,
0xf200
,
0xf702
,
0xf200
,
0xf200
,
0xfb41
,
0xfb53
,
/* D F G H J K L : */
0xfb44
,
0xfb46
,
0xfb47
,
0xfb48
,
0xfb4a
,
0xfb4b
,
0xfb4c
,
0xf03a
,
/* " Return | 4 5 6 */
0xf022
,
0xf200
,
0xf201
,
0xf07c
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
/* - <-- Next --> Rept Shift
Window */
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf200
,
0xf200
,
0xf700
,
0xf200
,
/* Z X C V B N M < */
0xfb5a
,
0xfb58
,
0xfb43
,
0xfb56
,
0xfb42
,
0xfb4e
,
0xfb4d
,
0xf03c
,
/* > ? Shift Pop 1 2 */
0xf03e
,
0xf03f
,
0xf700
,
0xf200
,
0xf200
,
0xf200
,
0xf301
,
0xf302
,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303
,
0xf200
,
0xf118
,
0xf603
,
0xf119
,
0xf703
,
0xf020
,
0xf701
,
/* 0 . Enter */
0xf200
,
0xf300
,
0xf200
,
0xf310
,
0xf30e
,
0xf200
,
0xf708
,
0xf200
,
};
static
u_short
dnctrl_map
[
NR_KEYS
]
__initdata
=
{
/* ins del del F1 F2 F3 F4
mark line char */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
/* Save Abort Help Cut Undo Grow ESC */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf01b
,
/* ! @ # $ % ^ & * */
0xf200
,
0xf000
,
0xf01b
,
0xf01c
,
0xf01d
,
0xf01e
,
0xf01f
,
0xf07f
,
/* ( ) _ + ~ Back |<--
Space */
0xf200
,
0xf200
,
0xf01f
,
0xf200
,
0xf01c
,
0xf200
,
0xf200
,
0xf200
,
/* Shell -->| Tab Q W E
Cmd */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf009
,
0xf011
,
0xf017
,
0xf005
,
/* R T Y U I O P { */
0xf012
,
0xf014
,
0xf019
,
0xf015
,
0xf009
,
0xf00f
,
0xf010
,
0xf01b
,
/* } Del 7 8 9 + */
0xf01d
,
0xf200
,
0xf200
,
0xf200
,
0xf307
,
0xf308
,
0xf300
,
0xf30a
,
/* [<--] Up [-->] Ctrl A S */
0xf200
,
0xf600
,
0xf200
,
0xf702
,
0xf200
,
0xf200
,
0xfb01
,
0xfb53
,
/* D F G H J K L : */
0xf004
,
0xf006
,
0xf007
,
0xf008
,
0xf00a
,
0xf00b
,
0xf00c
,
0xf200
,
/* " Return | 4 5 6 */
0xf200
,
0xf200
,
0xf201
,
0xf01c
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
/* - <-- Next --> Rept Shift
Window */
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf200
,
0xf200
,
0xf704
,
0xf200
,
/* Z X C V B N M < */
0xf01a
,
0xf018
,
0xf003
,
0xf016
,
0xf002
,
0xf00e
,
0xf01d
,
0xf03c
,
/* > ? Shift Pop 1 2 */
0xf03e
,
0xf03f
,
0xf705
,
0xf200
,
0xf200
,
0xf200
,
0xf301
,
0xf302
,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303
,
0xf200
,
0xf118
,
0xf603
,
0xf119
,
0xf703
,
0xf020
,
0xf701
,
/* 0 . Enter */
0xf200
,
0xf300
,
0xf200
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
dnalt_map
[
NR_KEYS
]
__initdata
=
{
/* ins del del F1 F2 F3 F4
mark line char */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf500
,
0xf501
,
0xf502
,
0xf503
,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf504
,
0xf505
,
0xf506
,
0xf507
,
0xf508
,
0xf509
,
0xf200
,
0xf200
,
/* Edit Exit Hold Copy Paste Grow ESC */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf01b
,
/* 1 2 3 4 5 6 7 8 */
0xf831
,
0xf832
,
0xf833
,
0xf834
,
0xf835
,
0xf836
,
0xf837
,
0xf838
,
/* 9 0 - = ` Back |<--
Space */
0xf839
,
0xf830
,
0xf82d
,
0xf83d
,
0xf860
,
0xf87f
,
0xf200
,
0xf200
,
/* Shell -->| Tab q w e
Cmd */
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf809
,
0xf871
,
0xf877
,
0xf865
,
/* r t y u i o p [ */
0xf872
,
0xf874
,
0xf879
,
0xf875
,
0xf869
,
0xf86f
,
0xf870
,
0xf85b
,
/* ] Del 7 8 9 + */
0xf05d
,
0xf200
,
0xf200
,
0xf200
,
0xf307
,
0xf308
,
0xf300
,
0xf30a
,
/* [<--] Up [-->] Ctrl a s */
0xf200
,
0xf600
,
0xf200
,
0xf702
,
0xf200
,
0xf200
,
0xf861
,
0xf873
,
/* d f g h j k l ; */
0xf864
,
0xf866
,
0xf867
,
0xf868
,
0xf86a
,
0xf86b
,
0xf86c
,
0xf03b
,
/* ' Return \ 4 5 6 */
0xf027
,
0xf200
,
0xf201
,
0xf05c
,
0xf200
,
0xf304
,
0xf305
,
0xf306
,
/* - <-- Next --> Rept Shift
Window */
0xf30b
,
0xf601
,
0xf200
,
0xf602
,
0xf200
,
0xf200
,
0xf704
,
0xf200
,
/* z x c v b n m , */
0xf87a
,
0xf878
,
0xf863
,
0xf876
,
0xf862
,
0xf86e
,
0xf86d
,
0xf82c
,
/* . / Shift Pop 1 2 */
0xf82e
,
0xf82f
,
0xf705
,
0xf200
,
0xf200
,
0xf200
,
0xf301
,
0xf302
,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303
,
0xf200
,
0xf118
,
0xf603
,
0xf119
,
0xf703
,
0xf820
,
0xf701
,
/* 0 . Enter */
0xf200
,
0xf300
,
0xf200
,
0xf310
,
0xf30e
,
0xf200
,
0xf200
,
0xf200
,
};
static
u_short
dnaltgr_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
dnshift_ctrl_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
static
u_short
dnctrl_alt_map
[
NR_KEYS
]
__initdata
=
{
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
,
0xf200
};
#if 0
static void debug_keyb_timer_handler(unsigned long ignored) {
unsigned long flags;
u_char *swap;
short length,i;
if (time_after(jiffies, debug_buffer_updated + 100)) {
save_flags(flags);
cli();
length=debug_buf_count;
swap=debug_buf;
debug_buf=shadow_buf;
shadow_buf=swap;
debug_buf_count=0;
debug_timer_running=0;
restore_flags(flags);
for(i=1;length;length--,i++)
printk("%02x%c",*(swap++), (i % 25) ? ' ' : '\n');
printk("\n");
}
else {
debug_keyb_timer.expires=jiffies+10;
add_timer(&debug_keyb_timer);
}
}
#endif
static
void
dn_keyb_process_key_event
(
unsigned
char
scancode
)
{
static
unsigned
char
lastscancode
;
unsigned
char
prev_scancode
=
lastscancode
;
static
unsigned
int
lastkeypress
;
lastscancode
=
scancode
;
/* printk("scan: %02x, lastscan: %02X, prev_scancode: %02X\n",scancode,lastscancode,prev_scancode); */
if
(
prev_scancode
==
APOLLO_KBD_MODE_CHANGE
)
{
kbd_mode
=
scancode
;
/* printk("modechange: %d\n",scancode); */
}
else
if
((
scancode
&
(
~
BREAK_FLAG
))
==
DNKEY_CAPS
)
{
/* printk("handle_scancode: %02x\n",DNKEY_CAPS); */
handle_scancode
(
DNKEY_CAPS
,
1
);
/* printk("handle_scancode: %02x\n",BREAK_FLAG | DNKEY_CAPS); */
handle_scancode
(
DNKEY_CAPS
,
0
);
}
else
if
(
(
scancode
==
DNKEY_REPEAT
)
&&
(
prev_scancode
<
0x7e
)
&&
!
(
prev_scancode
==
DNKEY_CTRL
||
prev_scancode
==
DNKEY_LSHIFT
||
prev_scancode
==
DNKEY_RSHIFT
||
prev_scancode
==
DNKEY_REPT
||
prev_scancode
==
DNKEY_LALT
||
prev_scancode
==
DNKEY_RALT
))
{
if
(
time_after
(
jiffies
,
lastkeypress
+
DNKEY_REPEAT_DELAY
))
{
/* printk("handle_scancode: %02x\n",prev_scancode); */
handle_scancode
(
prev_scancode
,
1
);
}
lastscancode
=
prev_scancode
;
}
else
{
/* printk("handle_scancode: %02x\n",scancode); */
handle_scancode
(
scancode
&
~
BREAK_FLAG
,
!
(
scancode
&
BREAK_FLAG
));
lastkeypress
=
jiffies
;
}
}
static
void
dn_keyb_process_mouse_event
(
unsigned
char
mouse_data
)
{
static
short
mouse_byte_count
=
0
;
static
u_char
mouse_packet
[
3
];
short
buttons
;
int
dx
,
dy
;
mouse_packet
[
mouse_byte_count
++
]
=
mouse_data
;
if
(
mouse_byte_count
==
3
)
{
if
(
mouse_packet
[
0
]
==
APOLLO_KBD_MODE_CHANGE
)
{
kbd_mode
=
mouse_packet
[
1
];
mouse_byte_count
=
0
;
/* printk("modechange: %d\n",mouse_packet[1]); */
if
(
kbd_mode
==
APOLLO_KBD_MODE_KEYB
)
dn_keyb_process_key_event
(
mouse_packet
[
2
]);
}
if
((
mouse_packet
[
0
]
&
0x8f
)
==
0x80
)
{
buttons
=
(
mouse_packet
[
0
]
>>
4
)
&
0x7
;
dx
=
mouse_packet
[
1
]
==
0xff
?
0
:
(
signed
char
)
mouse_packet
[
1
];
dy
=
mouse_packet
[
2
]
==
0xff
?
0
:
(
signed
char
)
mouse_packet
[
2
];
busmouse_add_movementbuttons
(
msedev
,
dx
,
dy
,
buttons
);
mouse_byte_count
=
0
;
/* printk("mouse: %d, %d, %x\n",mouse_x,mouse_y,buttons); */
}
}
}
static
void
dn_keyb_int
(
int
irq
,
void
*
dummy
,
struct
pt_regs
*
fp
)
{
unsigned
char
data
;
unsigned
long
flags
;
int
scn2681_ints
;
do
{
scn2681_ints
=
sio01
.
isr_imr
&
3
;
if
(
scn2681_ints
&
2
)
{
data
=
sio01
.
rhra_thra
;
#if 0
if(debug_buf_count<4096) {
debug_buf[debug_buf_count++]=data;
debug_buffer_updated=jiffies;
if(!debug_timer_running) {
debug_keyb_timer.expires=jiffies+10;
add_timer(&debug_keyb_timer);
debug_timer_running=1;
}
}
else
debug_buf_overrun=1;
#endif
if
(
sio01
.
sra_csra
&
0x10
)
{
printk
(
"whaa overrun !
\n
"
);
continue
;
}
if
(
kbd_mode
==
APOLLO_KBD_MODE_KEYB
)
dn_keyb_process_key_event
(
data
);
else
dn_keyb_process_mouse_event
(
data
);
}
if
(
scn2681_ints
&
1
)
{
save_flags
(
flags
);
cli
();
if
(
keyb_cmd_write
!=
keyb_cmd_read
)
{
sio01
.
rhra_thra
=
keyb_cmds
[
keyb_cmd_read
++
];
if
(
keyb_cmd_read
==
APOLLO_KEYB_CMD_ENTRIES
)
keyb_cmd_read
=
0
;
keyb_cmd_transmit
=
1
;
}
else
{
keyb_cmd_transmit
=
0
;
sio01
.
BRGtest_cra
=
9
;
}
restore_flags
(
flags
);
}
}
while
(
scn2681_ints
)
;
}
void
write_keyb_cmd
(
u_short
length
,
u_char
*
cmd
)
{
unsigned
long
flags
;
if
((
keyb_cmd_write
==
keyb_cmd_read
)
&&
keyb_cmd_transmit
)
return
;
save_flags
(
flags
);
cli
();
for
(;
length
;
length
--
)
{
keyb_cmds
[
keyb_cmd_write
++
]
=*
(
cmd
++
);
if
(
keyb_cmd_write
==
keyb_cmd_read
)
return
;
if
(
keyb_cmd_write
==
APOLLO_KEYB_CMD_ENTRIES
)
keyb_cmd_write
=
0
;
}
if
(
!
keyb_cmd_transmit
)
{
sio01
.
BRGtest_cra
=
5
;
}
restore_flags
(
flags
);
}
static
struct
busmouse
apollo_mouse
=
{
APOLLO_MOUSE_MINOR
,
"apollomouse"
,
THIS_MODULE
,
NULL
,
NULL
,
7
};
int
__init
dn_keyb_init
(
void
){
/* printk("dn_keyb_init\n"); */
memcpy
(
key_maps
[
0
],
dnplain_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
1
],
dnshift_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
2
],
dnaltgr_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
4
],
dnctrl_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
5
],
dnshift_ctrl_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
8
],
dnalt_map
,
sizeof
(
plain_map
));
memcpy
(
key_maps
[
12
],
dnctrl_alt_map
,
sizeof
(
plain_map
));
msedev
=
register_busmouse
(
&
apollo_mouse
);
if
(
msedev
<
0
)
printk
(
KERN_WARNING
"Unable to install Apollo mouse driver.
\n
"
);
else
printk
(
KERN_INFO
"Apollo mouse installed.
\n
"
);
/* program UpDownMode */
while
(
!
(
sio01
.
sra_csra
&
0x4
));
sio01
.
rhra_thra
=
0xff
;
while
(
!
(
sio01
.
sra_csra
&
0x4
));
sio01
.
rhra_thra
=
0x1
;
request_irq
(
1
,
dn_keyb_int
,
0
,
NULL
,
NULL
);
/* enable receive int on DUART */
sio01
.
isr_imr
=
3
;
return
0
;
}
int
dn_dummy_kbdrate
(
struct
kbd_repeat
*
k
)
{
printk
(
"dn_dummy_kbdrate
\n
"
);
return
0
;
}
drivers/char/q40_keyb.c
deleted
100644 → 0
View file @
e8d5b0ba
/*
* linux/drivers/char/q40_keyb.c
*
*/
#include <linux/config.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/mm.h>
#include <linux/keyboard.h>
#include <linux/signal.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/kbd_ll.h>
#include <linux/kbd_kern.h>
#include <linux/delay.h>
#include <linux/sysrq.h>
#include <linux/random.h>
#include <linux/poll.h>
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include <asm/keyboard.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/q40_master.h>
#include <asm/irq.h>
#include <asm/q40ints.h>
/* Simple translation table for the SysRq keys */
#define SYSRQ_KEY 0x54
#ifdef CONFIG_MAGIC_SYSRQ
unsigned
char
q40kbd_sysrq_xlate
[
128
]
=
"
\000\033
1234567890-=
\177\t
"
/* 0x00 - 0x0f */
"qwertyuiop[]
\r\000
as"
/* 0x10 - 0x1f */
"dfghjkl;'`
\000\\
zxcv"
/* 0x20 - 0x2f */
"bnm,./
\000
*
\000
\000\201\202\203\204\205
"
/* 0x30 - 0x3f */
"
\206\207\210\211\212\000\000
789-456+1"
/* 0x40 - 0x4f */
"230
\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000
"
/* 0x50 - 0x5f */
"
\r\000
/"
;
/* 0x60 - 0x6f */
#endif
/* Q40 uses AT scancodes - no way to change it. so we have to translate ..*/
/* 0x00 means not a valid entry or no conversion known */
unsigned
static
char
q40cl
[
256
]
=
{
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
0x00
,
0x43
,
0x00
,
0x3f
,
0x3d
,
0x3b
,
0x3c
,
0x58
,
0x00
,
0x44
,
0x42
,
0x40
,
0x3e
,
0x0f
,
0x29
,
0x00
,
/* 0x00 - 0x0f */
0x00
,
0x38
,
0x2a
,
0x00
,
0x1d
,
0x10
,
0x02
,
0x00
,
0x00
,
0x00
,
0x2c
,
0x1f
,
0x1e
,
0x11
,
0x03
,
0x00
,
/* 0x10 - 0x1f */
0x00
,
0x2e
,
0x2d
,
0x20
,
0x12
,
0x05
,
0x04
,
0x00
,
0x21
,
0x39
,
0x2f
,
0x21
,
0x14
,
0x13
,
0x06
,
0x00
,
/* 0x20 - 0x2f 'f' is at 0x2b, what is 0x28 ???*/
0x00
,
0x31
,
0x30
,
0x23
,
0x22
,
0x15
,
0x07
,
0x00
,
0x24
,
0x00
,
0x32
,
0x24
,
0x16
,
0x08
,
0x09
,
0x00
,
/* 0x30 - 0x3f */
0x00
,
0x33
,
0x25
,
0x17
,
0x18
,
0x0b
,
0x0a
,
0x00
,
0x00
,
0x34
,
0x35
,
0x26
,
0x27
,
0x19
,
0x0c
,
0x00
,
/* 0x40 - 0x4f */
0x00
,
0x00
,
0x28
,
0x00
,
0x1a
,
0x0d
,
0x00
,
0x00
,
0x3a
,
0x36
,
0x1c
,
0x1b
,
0x00
,
0x2b
,
0x00
,
0x00
,
/* 0x50 - 0x5f*/
0x00
,
0x56
,
0x00
,
0x00
,
0x00
,
0x00
,
0x0e
,
0x00
,
0x00
,
0x4f
,
0x00
,
0x4b
,
0x47
,
0x00
,
0x00
,
0x00
,
/* 0x60 - 0x6f */
0x52
,
0x53
,
0x50
,
0x4c
,
0x4d
,
0x48
,
0x01
,
0x45
,
0x57
,
0x4e
,
0x51
,
0x4a
,
0x37
,
0x49
,
0x46
,
0x00
,
/* 0x70 - 0x7f */
0x00
,
0x00
,
0x00
,
0x41
,
0x37
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x80 - 0x8f 0x84/0x37 is SySrq*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x90 - 0x9f */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xa0 - 0xaf */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xb0 - 0xbf */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xc0 - 0xcf */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xd0 - 0xdf */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xe0 - 0xef */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xf0 - 0xff */
};
/* another table, AT 0xe0 codes to PC 0xe0 codes,
0xff special entry for SysRq - DROPPED right now */
static
unsigned
char
q40ecl
[]
=
{
/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x00 - 0x0f*/
0x00
,
0x38
,
0x2a
,
0x00
,
0x1d
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x10 - 0x1f */
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x20 - 0x2f*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x30 - 0x3f*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x35
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x40 - 0x4f*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x36
,
0x1c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x50 - 0x5f*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x4f
,
0x00
,
0x4b
,
0x47
,
0x00
,
0x00
,
0x00
,
/* 0x60 - 0x6f*/
0x52
,
0x53
,
0x50
,
0x00
,
0x4d
,
0x48
,
0x00
,
0x00
,
0x00
,
0x00
,
0x51
,
0x00
,
0x00
,
0x49
,
0x00
,
0x00
,
/* 0x70 - 0x7f*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x80 - 0x8f*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0x90 - 0x9f*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xa0 - 0xaf*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xb0 - 0xbf*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xc0 - 0xcf*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xd0 - 0xdf*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 0xe0 - 0xef*/
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
/* 0xf0 - 0xff*/
};
static
spinlock_t
kbd_controller_lock
=
SPIN_LOCK_UNLOCKED
;
/*
* Translation of escaped scancodes to keycodes.
* This is now user-settable.
* The keycodes 1-88,96-111,119 are fairly standard, and
* should probably not be changed - changing might confuse X.
* X also interprets scancode 0x5d (KEY_Begin).
*
* For 1-88 keycode equals scancode.
*/
#define E0_KPENTER 96
#define E0_RCTRL 97
#define E0_KPSLASH 98
#define E0_PRSCR 99
#define E0_RALT 100
#define E0_BREAK 101
/* (control-pause) */
#define E0_HOME 102
#define E0_UP 103
#define E0_PGUP 104
#define E0_LEFT 105
#define E0_RIGHT 106
#define E0_END 107
#define E0_DOWN 108
#define E0_PGDN 109
#define E0_INS 110
#define E0_DEL 111
#define E1_PAUSE 119
/*
* The keycodes below are randomly located in 89-95,112-118,120-127.
* They could be thrown away (and all occurrences below replaced by 0),
* but that would force many users to use the `setkeycodes' utility, where
* they needed not before. It does not matter that there are duplicates, as
* long as no duplication occurs for any single keyboard.
*/
#define SC_LIM 89
#define FOCUS_PF1 85
/* actual code! */
#define FOCUS_PF2 89
#define FOCUS_PF3 90
#define FOCUS_PF4 91
#define FOCUS_PF5 92
#define FOCUS_PF6 93
#define FOCUS_PF7 94
#define FOCUS_PF8 95
#define FOCUS_PF9 120
#define FOCUS_PF10 121
#define FOCUS_PF11 122
#define FOCUS_PF12 123
#define JAP_86 124
/* tfj@olivia.ping.dk:
* The four keys are located over the numeric keypad, and are
* labelled A1-A4. It's an rc930 keyboard, from
* Regnecentralen/RC International, Now ICL.
* Scancodes: 59, 5a, 5b, 5c.
*/
#define RGN1 124
#define RGN2 125
#define RGN3 126
#define RGN4 127
static
unsigned
char
high_keys
[
128
-
SC_LIM
]
=
{
RGN1
,
RGN2
,
RGN3
,
RGN4
,
0
,
0
,
0
,
/* 0x59-0x5f */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x60-0x67 */
0
,
0
,
0
,
0
,
0
,
FOCUS_PF11
,
0
,
FOCUS_PF12
,
/* 0x68-0x6f */
0
,
0
,
0
,
FOCUS_PF2
,
FOCUS_PF9
,
0
,
0
,
FOCUS_PF3
,
/* 0x70-0x77 */
FOCUS_PF4
,
FOCUS_PF5
,
FOCUS_PF6
,
FOCUS_PF7
,
/* 0x78-0x7b */
FOCUS_PF8
,
JAP_86
,
FOCUS_PF10
,
0
/* 0x7c-0x7f */
};
/* BTC */
#define E0_MACRO 112
/* LK450 */
#define E0_F13 113
#define E0_F14 114
#define E0_HELP 115
#define E0_DO 116
#define E0_F17 117
#define E0_KPMINPLUS 118
/*
* My OmniKey generates e0 4c for the "OMNI" key and the
* right alt key does nada. [kkoller@nyx10.cs.du.edu]
*/
#define E0_OK 124
/*
* New microsoft keyboard is rumoured to have
* e0 5b (left window button), e0 5c (right window button),
* e0 5d (menu button). [or: LBANNER, RBANNER, RMENU]
* [or: Windows_L, Windows_R, TaskMan]
*/
#define E0_MSLW 125
#define E0_MSRW 126
#define E0_MSTM 127
/* this can be changed using setkeys : */
static
unsigned
char
e0_keys
[
128
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x00-0x07 */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x08-0x0f */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x10-0x17 */
0
,
0
,
0
,
0
,
E0_KPENTER
,
E0_RCTRL
,
0
,
0
,
/* 0x18-0x1f */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x20-0x27 */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x28-0x2f */
0
,
0
,
0
,
0
,
0
,
E0_KPSLASH
,
0
,
E0_PRSCR
,
/* 0x30-0x37 */
E0_RALT
,
0
,
0
,
0
,
0
,
E0_F13
,
E0_F14
,
E0_HELP
,
/* 0x38-0x3f */
E0_DO
,
E0_F17
,
0
,
0
,
0
,
0
,
E0_BREAK
,
E0_HOME
,
/* 0x40-0x47 */
E0_UP
,
E0_PGUP
,
0
,
E0_LEFT
,
E0_OK
,
E0_RIGHT
,
E0_KPMINPLUS
,
E0_END
,
/* 0x48-0x4f */
E0_DOWN
,
E0_PGDN
,
E0_INS
,
E0_DEL
,
0
,
0
,
0
,
0
,
/* 0x50-0x57 */
0
,
0
,
0
,
E0_MSLW
,
E0_MSRW
,
E0_MSTM
,
0
,
0
,
/* 0x58-0x5f */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x60-0x67 */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
E0_MACRO
,
/* 0x68-0x6f */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
/* 0x70-0x77 */
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
/* 0x78-0x7f */
};
int
q40kbd_setkeycode
(
unsigned
int
scancode
,
unsigned
int
keycode
)
{
if
(
scancode
<
SC_LIM
||
scancode
>
255
||
keycode
>
127
)
return
-
EINVAL
;
if
(
scancode
<
128
)
high_keys
[
scancode
-
SC_LIM
]
=
keycode
;
else
e0_keys
[
scancode
-
128
]
=
keycode
;
return
0
;
}
int
q40kbd_getkeycode
(
unsigned
int
scancode
)
{
return
(
scancode
<
SC_LIM
||
scancode
>
255
)
?
-
EINVAL
:
(
scancode
<
128
)
?
high_keys
[
scancode
-
SC_LIM
]
:
e0_keys
[
scancode
-
128
];
}
#define disable_keyboard()
#define enable_keyboard()
int
q40kbd_translate
(
unsigned
char
scancode
,
unsigned
char
*
keycode
,
char
raw_mode
)
{
static
int
prev_scancode
;
/* special prefix scancodes.. */
if
(
scancode
==
0xe0
||
scancode
==
0xe1
)
{
prev_scancode
=
scancode
;
return
0
;
}
/* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
if
(
scancode
==
0x00
||
scancode
==
0xff
)
{
prev_scancode
=
0
;
return
0
;
}
scancode
&=
0x7f
;
if
(
prev_scancode
)
{
/*
* usually it will be 0xe0, but a Pause key generates
* e1 1d 45 e1 9d c5 when pressed, and nothing when released
*/
if
(
prev_scancode
!=
0xe0
)
{
if
(
prev_scancode
==
0xe1
&&
scancode
==
0x1d
)
{
prev_scancode
=
0x100
;
return
0
;
}
else
if
(
prev_scancode
==
0x100
&&
scancode
==
0x45
)
{
*
keycode
=
E1_PAUSE
;
prev_scancode
=
0
;
}
else
{
#ifdef KBD_REPORT_UNKN
if
(
!
raw_mode
)
printk
(
KERN_INFO
"keyboard: unknown e1 escape sequence
\n
"
);
#endif
prev_scancode
=
0
;
return
0
;
}
}
else
{
prev_scancode
=
0
;
/*
* The keyboard maintains its own internal caps lock and
* num lock statuses. In caps lock mode E0 AA precedes make
* code and E0 2A follows break code. In num lock mode,
* E0 2A precedes make code and E0 AA follows break code.
* We do our own book-keeping, so we will just ignore these.
*/
/*
* For my keyboard there is no caps lock mode, but there are
* both Shift-L and Shift-R modes. The former mode generates
* E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs.
* So, we should also ignore the latter. - aeb@cwi.nl
*/
if
(
scancode
==
0x2a
||
scancode
==
0x36
)
return
0
;
if
(
e0_keys
[
scancode
])
*
keycode
=
e0_keys
[
scancode
];
else
{
#ifdef KBD_REPORT_UNKN
if
(
!
raw_mode
)
printk
(
KERN_INFO
"keyboard: unknown scancode e0 %02x
\n
"
,
scancode
);
#endif
return
0
;
}
}
}
else
if
(
scancode
>=
SC_LIM
)
{
/* This happens with the FOCUS 9000 keyboard
Its keys PF1..PF12 are reported to generate
55 73 77 78 79 7a 7b 7c 74 7e 6d 6f
Moreover, unless repeated, they do not generate
key-down events, so we have to zero up_flag below */
/* Also, Japanese 86/106 keyboards are reported to
generate 0x73 and 0x7d for \ - and \ | respectively. */
/* Also, some Brazilian keyboard is reported to produce
0x73 and 0x7e for \ ? and KP-dot, respectively. */
*
keycode
=
high_keys
[
scancode
-
SC_LIM
];
if
(
!*
keycode
)
{
if
(
!
raw_mode
)
{
#ifdef KBD_REPORT_UNKN
printk
(
KERN_INFO
"keyboard: unrecognized scancode (%02x)"
" - ignored
\n
"
,
scancode
);
#endif
}
return
0
;
}
}
else
*
keycode
=
scancode
;
return
1
;
}
char
q40kbd_unexpected_up
(
unsigned
char
keycode
)
{
/* unexpected, but this can happen: maybe this was a key release for a
FOCUS 9000 PF key; if we want to see it, we have to clear up_flag */
if
(
keycode
>=
SC_LIM
||
keycode
==
85
)
return
0
;
else
return
0200
;
}
static
int
keyup
=
0
;
static
int
qprev
=
0
;
static
void
keyboard_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
unsigned
char
status
;
spin_lock
(
&
kbd_controller_lock
);
kbd_pt_regs
=
regs
;
status
=
IRQ_KEYB_MASK
&
master_inb
(
INTERRUPT_REG
);
if
(
status
)
{
unsigned
char
scancode
,
qcode
;
qcode
=
master_inb
(
KEYCODE_REG
);
if
(
qcode
!=
0xf0
)
{
if
(
qcode
==
0xe0
)
{
qprev
=
0xe0
;
handle_scancode
(
qprev
,
1
);
goto
exit
;
}
scancode
=
qprev
?
q40ecl
[
qcode
]
:
q40cl
[
qcode
];
#if 0
/* next line is last resort to hanlde some oddities */
if (qprev && !scancode) scancode=q40cl[qcode];
#endif
qprev
=
0
;
if
(
!
scancode
)
{
printk
(
"unknown scancode %x
\n
"
,
qcode
);
goto
exit
;
}
if
(
scancode
==
0xff
)
/* SySrq */
scancode
=
SYSRQ_KEY
;
handle_scancode
(
scancode
,
!
keyup
);
keyup
=
0
;
tasklet_schedule
(
&
keyboard_tasklet
);
}
else
keyup
=
1
;
}
exit:
spin_unlock
(
&
kbd_controller_lock
);
master_outb
(
-
1
,
KEYBOARD_UNLOCK_REG
);
/* keyb ints reenabled herewith */
}
#define KBD_NO_DATA (-1)
/* No data */
#define KBD_BAD_DATA (-2)
/* Parity or other error */
static
int
__init
kbd_read_input
(
void
)
{
int
retval
=
KBD_NO_DATA
;
unsigned
char
status
;
status
=
IRQ_KEYB_MASK
&
master_inb
(
INTERRUPT_REG
);
if
(
status
)
{
unsigned
char
data
=
master_inb
(
KEYCODE_REG
);
retval
=
data
;
master_outb
(
-
1
,
KEYBOARD_UNLOCK_REG
);
}
return
retval
;
}
static
void
__init
kbd_clear_input
(
void
)
{
int
maxread
=
100
;
/* Random number */
do
{
if
(
kbd_read_input
()
==
KBD_NO_DATA
)
break
;
}
while
(
--
maxread
);
}
int
__init
q40kbd_init_hw
(
void
)
{
/* Flush any pending input. */
kbd_clear_input
();
/* Ok, finally allocate the IRQ, and off we go.. */
request_irq
(
Q40_IRQ_KEYBOARD
,
keyboard_interrupt
,
0
,
"keyboard"
,
NULL
);
master_outb
(
-
1
,
KEYBOARD_UNLOCK_REG
);
master_outb
(
1
,
KEY_IRQ_ENABLE_REG
);
return
0
;
}
include/asm-m68k/q40_keyboard.h
deleted
100644 → 0
View file @
e8d5b0ba
/*
* linux/include/asm-m68k/q40_keyboard.h
*
* Q40 specific keyboard definitions
*/
#ifdef __KERNEL__
#include <asm/machdep.h>
extern
int
q40kbd_setkeycode
(
unsigned
int
scancode
,
unsigned
int
keycode
);
extern
int
q40kbd_getkeycode
(
unsigned
int
scancode
);
extern
int
q40kbd_pretranslate
(
unsigned
char
scancode
,
char
raw_mode
);
extern
int
q40kbd_translate
(
unsigned
char
scancode
,
unsigned
char
*
keycode
,
char
raw_mode
);
extern
char
q40kbd_unexpected_up
(
unsigned
char
keycode
);
extern
void
q40kbd_leds
(
unsigned
char
leds
);
extern
int
q40kbd_is_sysrq
(
unsigned
char
keycode
);
extern
int
q40kbd_init_hw
(
void
);
extern
unsigned
char
q40kbd_sysrq_xlate
[
128
];
#endif
/* __KERNEL__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment