-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can register interrupt handlers now
- Loading branch information
Showing
14 changed files
with
169 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <device/devicemanager.h> | ||
|
||
using namespace Device; | ||
|
||
Keyboard* DeviceManager::keyboard; | ||
PIC* DeviceManager::pic; | ||
|
||
void DeviceManager::Initialize() { | ||
keyboard = new Keyboard(); | ||
keyboard->Initialize(); | ||
|
||
pic = new PIC(); | ||
pic->Remap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include <device/cpu.h> | ||
#include <device/devicemanager.h> | ||
#include <string.h> | ||
extern "C" | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef _DEVICEMANAGER_H | ||
#define _DEVICEMANAGER_H | ||
|
||
#include "cpu.h" | ||
#include "keyboard.h" | ||
#include "pic.h" | ||
|
||
namespace Device | ||
{ | ||
|
||
class DeviceManager | ||
{ | ||
public: | ||
static Keyboard *keyboard; | ||
|
||
static PIC *pic; | ||
|
||
static void Initialize(); | ||
}; | ||
|
||
} // namespace Device | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
#ifndef _KEYBOARD_H | ||
#define _KEYBOARD_H | ||
|
||
#include <kernel/interrupts.h> | ||
|
||
namespace Device | ||
{ | ||
class Keyboard | ||
class Keyboard : public Kernel::InterruptHandler | ||
{ | ||
private: | ||
static char scancode_map[128]; | ||
char scancode_map[128]; | ||
|
||
public: | ||
static void Initialize(); | ||
void Initialize(); | ||
|
||
static void HandleInterrupt(unsigned int scancode); | ||
void HandleInterrupt(unsigned int interrupt) override; | ||
|
||
private: | ||
static void NewScancode(unsigned int code, char c); | ||
|
||
static char MapChar(unsigned int scancode); | ||
void NewScancode(unsigned int code, char c); | ||
char MapChar(unsigned int scancode); | ||
}; | ||
} // namespace Device | ||
} // namespace Device | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
#ifndef _PIC_H | ||
#define _PIC_H | ||
|
||
namespace Device | ||
{ | ||
|
||
class PIC | ||
{ | ||
public: | ||
static void Remap(); | ||
void Remap(); | ||
}; | ||
|
||
} // namespace Device | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <stddef.h> | ||
#include <stdlib.h> | ||
|
||
extern "C" void __cxa_pure_virtual() | ||
{ | ||
// Do nothing or print an error message. | ||
} | ||
|
||
void *operator new(size_t size) | ||
{ | ||
return malloc(size); | ||
} | ||
|
||
void *operator new[](size_t size) | ||
{ | ||
return malloc(size); | ||
} | ||
|
||
void operator delete(void *p) | ||
{ | ||
free(p); | ||
} | ||
|
||
void operator delete[](void *p) | ||
{ | ||
free(p); | ||
} |
Oops, something went wrong.