luxos/SysCore/include/hal.h
2021-09-14 18:46:50 +03:00

167 lines
6.3 KiB
C

#ifndef _HAL_H
#define _HAL_H
#include <stdint.h>
#include <time.h>
//#include <..\hal\floppy\floppy.h>
#define far
#define near
#define i86_start_interrupts() __asm__ __volatile__ ("sti");
#define i86_clear_interrupts() __asm__ __volatile__ ("cli");
extern TIME ClockGetTime() ;
extern unsigned* i86_read_sector (unsigned* where, unsigned char drive, int sectorLBA);
// initialize hardware abstraction layer
extern void i86_hal_initialize ();
// shutdown hardware abstraction layer
extern int i86_hal_shutdown ();
//! notifies hal interrupt is done
//extern void interruptdone (unsigned int intno);
//! output sound to speaker
extern void sound (unsigned frequency);
//! read unsigned char from device using port mapped io
//extern unsigned char inportb (unsigned short _port);
//! write unsigned char to device through port mapped io
//extern void outportb (unsigned short _port, unsigned char _data);
//! sets new interrupt vector
//extern void setvect (int intno, void ( far &vect) ( ) );
//! returns current interrupt vector
//extern void ( far * getvect (int intno)) ( );
//! returns cpu vender
extern const char* get_cpu_vender ();
extern void SystemReboot();
/**********************************************************************
* KEYBOARD STUFF *
**********************************************************************/
#define KeyboardKeyModifierLeftShift 0x81 // 1000 0001
#define KeyboardKeyModifierRightShift 0x82 // 1000 0010
#define KeyboardKeyModifierLeftAlt 0x84 // 1000 0100
#define KeyboardKeyModifierRightAlt 0x88 // 1000 1000
#define KeyboardKeyModifierLeftCtrl 0x90 // 1001 0000
#define KeyboardKeyModifierRightCtrl 0xA0 // 1010 0000
#define KeyboardKeyFakeShift 0xC0 // 1100 0000
#define KeyboardLightScroll 0xF1 // 1111 0001
#define KeyboardLightNum 0xF2 // 1111 0010
#define KeyboardLightCaps 0xF4 // 1111 0100
enum KeyboardKeys {
KeyboardKeyPause = 0x00,
KeyboardKeyF9 = 0x01,
KeyboardKeyF7 = 0x02,
KeyboardKeyF5 = 0X03,
KeyboardKeyF3 = 0x04,
KeyboardKeyF1 = 0x05,
KeyboardKeyF2 = 0x06,
KeyboardKeyF12 = 0x07,
KeyboardKeyPrintScreen = 0x08,
KeyboardKeyF10 = 0x09,
KeyboardKeyF8 = 0x0A,
KeyboardKeyF6 = 0x0B,
KeyboardKeyF4 = 0x0C,
KeyboardKeyTab = 0x0D,
KeyboardKeyTilda = 0x0E,
KeyboardKeyQ = 0x15,
KeyboardKey1 = 0x16,
KeyboardKeyZ = 0x1A,
KeyboardKeyS = 0x1B,
KeyboardKeyA = 0x1C,
KeyboardKeyW = 0x1D,
KeyboardKey2 = 0x1E,
KeyboardKeyLeftWin = 0x1F,
KeyboardKeyC = 0x21,
KeyboardKeyX = 0x22,
KeyboardKeyD = 0x23,
KeyboardKeyE = 0x24,
KeyboardKey4 = 0x25,
KeyboardKey3 = 0x26,
KeyboardKeyRightWin = 0x27,
KeyboardKeySpace = 0x29,
KeyboardKeyV = 0x2A,
KeyboardKeyF = 0x2B,
KeyboardKeyT = 0x2C,
KeyboardKeyR = 0x2D,
KeyboardKey5 = 0x2E,
KeyboardKeyMenu = 0x2F,
KeyboardKeyN = 0x31,
KeyboardKeyB = 0x32,
KeyboardKeyH = 0x33,
KeyboardKeyG = 0x34,
KeyboardKeyY = 0x35,
KeyboardKey6 = 0x36,
KeyboardKeyM = 0x3A,
KeyboardKeyJ = 0x3B,
KeyboardKeyU = 0x3C,
KeyboardKey7 = 0x3D,
KeyboardKey8 = 0x3E,
KeyboardKeyComma = 0x41,
KeyboardKeyK = 0x42,
KeyboardKeyI = 0x43,
KeyboardKeyO = 0x44,
KeyboardKey0 = 0x45,
KeyboardKey9 = 0x46,
KeyboardKeyPeriod = 0x49,
KeyboardKeySlash = 0x4A,
KeyboardKeyL = 0x4B,
KeyboardKeySemicolon = 0x4C,
KeyboardKeyP = 0x4D,
KeyboardKeyDash = 0x4E,
KeyboardKeyApostrophe = 0x52,
KeyboardKeyLeftBracket = 0x54,
KeyboardKeyEqual = 0x55,
KeyboardKeyNumpadEnter = 0x59,
KeyboardKeyReturn = 0x5A,
KeyboardKeyRightBracket = 0x5B,
KeyboardKeyBackSlash = 0x5D,
KeyboardKeyEnd = 0x5E,
KeyboardKeyLeft = 0x5F,
KeyboardKeyHome = 0x60,
KeyboardKeyInsert = 0x61,
KeyboardKeyDelete = 0x62,
KeyboardKeyDown = 0x63,
KeyboardKeyRight = 0x64,
KeyboardKeyUp = 0x65,
KeyboardKeyBackspace = 0x66,
KeyboardKeyPageDown = 0x67,
KeyboardKeyPageUp = 0x68,
KeyboardKeyNumpad1 = 0x69,
KeyboardKeyNumpadSlash = 0x6A,
KeyboardKeyNumpad4 = 0x6B,
KeyboardKeyNumpad7 = 0x6C,
KeyboardKeyNumpad0 = 0x70,
KeyboardKeyNumpadColon = 0x71,
KeyboardKeyNumpad2 = 0x72,
KeyboardKeyNumpad5 = 0x73,
KeyboardKeyNumpad6 = 0x74,
KeyboardKeyNumpad8 = 0x75,
KeyboardKeyEscape = 0x76,
KeyboardKeyF11 = 0x78,
KeyboardKeyNumpadPlus = 0x79,
KeyboardKeyNumpad3 = 0x7A,
KeyboardKeyNumpadMinus = 0x7B,
KeyboardKeyNumpadAsterisk = 0x7C,
KeyboardKeyNumpad9 = 0x7D
};
typedef struct {
unsigned char ModifierStatus;
unsigned char Lights;
unsigned char Scancode;
unsigned char Character;
} KeyboardKey;
#endif