FreeNOS
Keyboard.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __SERVER_PS2_KEYBOARD_H
19#define __SERVER_PS2_KEYBOARD_H
20
21#include <FreeNOS/System.h>
22#include <Device.h>
23#include <Macros.h>
24#include <Types.h>
25
35#define PS2_PORT 0x60
36
38#define PS2_IRQ 1
39
41#define PS2_RELEASE 0x80
42
46class Keyboard : public Device
47{
48 public:
49
55 Keyboard(const u32 inode);
56
63
71 virtual FileSystem::Result interrupt(const Size vector);
72
83 virtual FileSystem::Result read(IOBuffer & buffer,
84 Size & size,
85 const Size offset);
86
87 private:
88
92 static const char keymap[0x3a][2];
93
100
103
106};
107
113#endif /* __SERVER_PS2_KEYBOARD_H */
Input/Output operations specific to the ARM architecture.
Definition ARMIO.h:40
Abstract device class interface.
Definition Device.h:36
Abstract Input/Output buffer.
Definition IOBuffer.h:38
PS2 Keyboard device driver.
Definition Keyboard.h:47
virtual FileSystem::Result interrupt(const Size vector)
Executed when a key state has changed.
Definition Keyboard.cpp:57
u8 shiftState
State of the shift key.
Definition Keyboard.h:99
static const char keymap[0x3a][2]
Keyboard map table.
Definition Keyboard.h:26
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read a character from the keyboard.
Definition Keyboard.cpp:63
bool pending
Do we have a byte ready?
Definition Keyboard.h:102
Arch::IO m_io
Port I/O object.
Definition Keyboard.h:105
virtual FileSystem::Result initialize()
Initialize the device.
Definition Keyboard.cpp:52
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
unsigned char u8
Unsigned 8-bit number.
Definition Types.h:59
Result
Result code for filesystem Actions.
Definition FileSystem.h:53