1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

minor enhancements

This commit is contained in:
Adrien Bourmault 2019-05-08 10:33:17 +02:00
parent d47f234261
commit 8a6cfd07c6
4 changed files with 37 additions and 20 deletions

View File

@ -26,8 +26,8 @@
#include <kernel/base.h> #include <kernel/base.h>
#endif #endif
#ifndef _KALKERN_IDT_H #ifndef _KALKERN_PWMGNT_H
#define _KALKERN_IDT_H #define _KALKERN_PWMGNT_H
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//

View File

@ -25,10 +25,13 @@
#include <kernel/base.h> #include <kernel/base.h>
#include <kernel/iomisc.h> #include <kernel/iomisc.h>
#include <extras/buf.h> #include <extras/buf.h>
#include <kernel/keyboard.h>
static char ScanCodes[100] = { 0 }; static char EarlyScanCodes[100] = { 0 };
static char Invisible[100] = { 0 }; static char Invisible[100] = { 0 };
char *ScanCodes = 0;
void KeybPrint(char code) void KeybPrint(char code)
{ {
uchar ch = ScanCodes[(int)code]; uchar ch = ScanCodes[(int)code];
@ -43,7 +46,9 @@ void KeybPrint(char code)
void ScanCodesInit(void) void ScanCodesInit(void)
{ {
ScanCodes[0x01] = 27; // ESC ScanCodes = &EarlyScanCodes[0];
ScanCodes[0x01] = KEY_ESC;
Invisible[0x01] = 1; Invisible[0x01] = 1;
ScanCodes[0x02] = '1'; ScanCodes[0x02] = '1';
ScanCodes[0x03] = '2'; ScanCodes[0x03] = '2';
@ -99,15 +104,15 @@ void ScanCodesInit(void)
ScanCodes[0x1C] = '\n'; ScanCodes[0x1C] = '\n';
ScanCodes[0x39] = ' '; ScanCodes[0x39] = ' ';
ScanCodes[0x40] = 7; // BEL ScanCodes[0x40] = KEY_BEL;
Invisible[0x40] = 1; Invisible[0x40] = 1;
// Numpad // Numpad
ScanCodes[0x48] = 17; // DC1, will serve as Arrow Up ScanCodes[0x48] = KEY_DC1; // DC1, will serve as Arrow Up
ScanCodes[0x50] = 18; // DC2, will serve as Arrow Down ScanCodes[0x50] = KEY_DC2; // DC2, will serve as Arrow Down
ScanCodes[0x4B] = 19; // DC3, will serve as Arrow Left ScanCodes[0x4B] = KEY_DC3; // DC3, will serve as Arrow Left
ScanCodes[0x4D] = 20; // DC4, will serve as Arrow Right ScanCodes[0x4D] = KEY_DC4; // DC4, will serve as Arrow Right
Invisible[0x48] = 1; Invisible[0x48] = 1;
Invisible[0x50] = 1; Invisible[0x50] = 1;
Invisible[0x4B] = 1; Invisible[0x4B] = 1;
@ -138,8 +143,8 @@ void IoCreateInputBuffer(void)
error_t rc; error_t rc;
rc = BOpenPureBuf(&BStdIn, BS_RDWR, 4 * KB); rc = BOpenPureBuf(&BStdIn, BS_RDWR, 4 * KB);
if (rc) KeStartPanic("Couldn't create BStdIn"); if (rc) KeStartPanic("[Keyb] Couldn't create BStdIn");
BEnableLineBuffering(BStdIn); BEnableLineBuffering(BStdIn);
} }
@ -159,3 +164,8 @@ void IoEnableKeyb(void)
IoCreateInputBuffer(); IoCreateInputBuffer();
} }
void IoChangeCodePage(char *CodePage)
{
ScanCodes = &CodePage[0];
}

View File

@ -25,7 +25,9 @@
#include <extras/buf.h> #include <extras/buf.h>
#include <kernel/time.h> #include <kernel/time.h>
#include <kernel/speaker.h> #include <kernel/speaker.h>
#include <kernel/iomisc.h>
#include <kernel/pwmgnt.h> #include <kernel/pwmgnt.h>
#include <kernel/keyboard.h>
extern void IoScrollDown(void); extern void IoScrollDown(void);
extern void IoScrollUp(void); extern void IoScrollUp(void);
@ -41,7 +43,7 @@ void KeStartShell(void)
while ((rc = bgetc(BStdIn, &ch)) == EOK) { while ((rc = bgetc(BStdIn, &ch)) == EOK) {
switch (ch) { switch (ch) {
case 7: // BEL case KEY_BEL:
if (rand() % 64 == 0) { if (rand() % 64 == 0) {
IoDoStarWars(); IoDoStarWars();
} }
@ -51,18 +53,23 @@ void KeStartShell(void)
BFlushBuf(BStdOut); BFlushBuf(BStdOut);
break; break;
case 17: // DC1 case KEY_DC1:
IoScrollUp(); IoScrollUp();
break; break;
case 18: // DC2 case KEY_DC2:
IoScrollDown(); IoScrollDown();
break; break;
case 27: // ESC case KEY_ESC:
PoShutdownQemu(); PoShutdownQemu();
break; break;
case '\n':
KernLog("shell > ");
BFlushBuf(BStdOut);
break;
} }
KePauseCPU();
} }
} }

View File

@ -28,7 +28,7 @@
noreturn void PoShutdownQemu(void) noreturn void PoShutdownQemu(void)
{ {
KernLog("Shutdown QEMU at %s...\n", IoGetRtcTimeChar()); KernLog("\nShutdown QEMU at %s...\n", IoGetRtcTimeChar());
IoRtcWait(1000); IoRtcWait(1000);
@ -39,7 +39,7 @@ noreturn void PoShutdownQemu(void)
noreturn void PoShutdownVirtualbox(void) noreturn void PoShutdownVirtualbox(void)
{ {
KernLog("Shutdown VirtualBox at %s...\n", IoGetRtcTimeChar()); KernLog("\nShutdown VirtualBox at %s...\n", IoGetRtcTimeChar());
IoRtcWait(1000); IoRtcWait(1000);
@ -50,7 +50,7 @@ noreturn void PoShutdownVirtualbox(void)
noreturn void PoShutdownBochs(void) noreturn void PoShutdownBochs(void)
{ {
KernLog("Shutdown Bochs at %s...\n", IoGetRtcTimeChar()); KernLog("\nShutdown Bochs at %s...\n", IoGetRtcTimeChar());
IoRtcWait(1000); IoRtcWait(1000);