Permalink
Browse files

Files for part 9, https://www.youtube.com/watch?v=BZoRplKZEuk

  • Loading branch information...
Viktor Engelmann Viktor Engelmann
Viktor Engelmann authored and Viktor Engelmann committed Jul 4, 2016
1 parent 890d69a commit 349d2f91ac364dc0302bef9b0aa685f4ce2b1e2f
View

This file was deleted.

Oops, something went wrong.
View
41 gdt.h

This file was deleted.

Oops, something went wrong.
View
@@ -0,0 +1,21 @@
#ifndef __MYOS__COMMON__TYPES_H
#define __MYOS__COMMON__TYPES_H
namespace myos
{
namespace common
{
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
}
}
#endif
View
@@ -0,0 +1,39 @@
#ifndef __MYOS__DRIVERS__DRIVER_H
#define __MYOS__DRIVERS__DRIVER_H
namespace myos
{
namespace drivers
{
class Driver
{
public:
Driver();
~Driver();
virtual void Activate();
virtual int Reset();
virtual void Deactivate();
};
class DriverManager
{
private:
Driver* drivers[265];
int numDrivers;
public:
DriverManager();
void AddDriver(Driver*);
void ActivateAll();
};
}
}
#endif
View
@@ -0,0 +1,40 @@
#ifndef __MYOS__DRIVERS__KEYBOARD_H
#define __MYOS__DRIVERS__KEYBOARD_H
#include <common/types.h>
#include <hardwarecommunication/interrupts.h>
#include <drivers/driver.h>
#include <hardwarecommunication/port.h>
namespace myos
{
namespace drivers
{
class KeyboardEventHandler
{
public:
KeyboardEventHandler();
virtual void OnKeyDown(char);
virtual void OnKeyUp(char);
};
class KeyboardDriver : public myos::hardwarecommunication::InterruptHandler, public Driver
{
myos::hardwarecommunication::Port8Bit dataport;
myos::hardwarecommunication::Port8Bit commandport;
KeyboardEventHandler* handler;
public:
KeyboardDriver(myos::hardwarecommunication::InterruptManager* manager, KeyboardEventHandler *handler);
~KeyboardDriver();
virtual myos::common::uint32_t HandleInterrupt(myos::common::uint32_t esp);
virtual void Activate();
};
}
}
#endif
View
@@ -0,0 +1,46 @@
#ifndef __MYOS__DRIVERS__MOUSE_H
#define __MYOS__DRIVERS__MOUSE_H
#include <common/types.h>
#include <hardwarecommunication/port.h>
#include <drivers/driver.h>
#include <hardwarecommunication/interrupts.h>
namespace myos
{
namespace drivers
{
class MouseEventHandler
{
public:
MouseEventHandler();
virtual void OnActivate();
virtual void OnMouseDown(myos::common::uint8_t button);
virtual void OnMouseUp(myos::common::uint8_t button);
virtual void OnMouseMove(int x, int y);
};
class MouseDriver : public myos::hardwarecommunication::InterruptHandler, public Driver
{
myos::hardwarecommunication::Port8Bit dataport;
myos::hardwarecommunication::Port8Bit commandport;
myos::common::uint8_t buffer[3];
myos::common::uint8_t offset;
myos::common::uint8_t buttons;
MouseEventHandler* handler;
public:
MouseDriver(myos::hardwarecommunication::InterruptManager* manager, MouseEventHandler* handler);
~MouseDriver();
virtual myos::common::uint32_t HandleInterrupt(myos::common::uint32_t esp);
virtual void Activate();
};
}
}
#endif
View
@@ -0,0 +1,46 @@
#ifndef __MYOS__GDT_H
#define __MYOS__GDT_H
#include <common/types.h>
namespace myos
{
class GlobalDescriptorTable
{
public:
class SegmentDescriptor
{
private:
myos::common::uint16_t limit_lo;
myos::common::uint16_t base_lo;
myos::common::uint8_t base_hi;
myos::common::uint8_t type;
myos::common::uint8_t limit_hi;
myos::common::uint8_t base_vhi;
public:
SegmentDescriptor(myos::common::uint32_t base, myos::common::uint32_t limit, myos::common::uint8_t type);
myos::common::uint32_t Base();
myos::common::uint32_t Limit();
} __attribute__((packed));
private:
SegmentDescriptor nullSegmentSelector;
SegmentDescriptor unusedSegmentSelector;
SegmentDescriptor codeSegmentSelector;
SegmentDescriptor dataSegmentSelector;
public:
GlobalDescriptorTable();
~GlobalDescriptorTable();
myos::common::uint16_t CodeSegmentSelector();
myos::common::uint16_t DataSegmentSelector();
};
}
#endif
Oops, something went wrong.

0 comments on commit 349d2f9

Please sign in to comment.