The Pedigree Project  0.1
kernel/machine/mach_pc/Keyboard.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef MACHINE_X86_KEYBOARD_H
21 #define MACHINE_X86_KEYBOARD_H
22 
23 #include "pedigree/kernel/compiler.h"
24 #include "pedigree/kernel/machine/Keyboard.h"
25 #include "pedigree/kernel/machine/KeymapManager.h"
26 #include "pedigree/kernel/machine/types.h"
27 #include "pedigree/kernel/processor/types.h"
28 
29 class Ps2Controller;
30 
31 #define BUFLEN 256
32 
36 class X86Keyboard : public Keyboard
37 {
38  public:
39  X86Keyboard(Ps2Controller *controller);
40  virtual ~X86Keyboard();
41 
43  virtual void initialise();
44 
45  virtual void setDebugState(bool enableDebugState);
46  virtual bool getDebugState();
47 
48  virtual char getChar();
49  virtual char getCharNonBlock();
50 
51  virtual char getLedState();
52  virtual void setLedState(char state);
53 
54  void startReaderThread();
55 
56  private:
57  static int readerThreadTrampoline(void *) NORETURN;
58  void readerThread() NORETURN;
59 
61  char scancodeToAscii(uint8_t scancode);
62 
65 
67  KeymapManager::EscapeState m_Escape;
68 
70  irq_id_t m_IrqId;
71 
73  char m_LedState;
74 };
75 
76 #endif
char scancodeToAscii(uint8_t scancode)
Converts a scancode into an ASCII character (for use in debug state)
virtual void setLedState(char state)
virtual char getCharNonBlock()
Ps2Controller * m_pPs2Controller
Parent PS/2 controller.
KeymapManager::EscapeState m_Escape
The current escape state.
virtual char getLedState()
virtual char getChar()
virtual void setDebugState(bool enableDebugState)
char m_LedState
Current LED state.
virtual void initialise()
Initialises the device.