mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Merge branch 'BetterTerm' into cpu
This commit is contained in:
commit
5a85baacbd
3
Makefile
3
Makefile
@ -98,7 +98,8 @@ KernSources = kernel/cpu/cpuid.c \
|
||||
kernel/mm/gdt.c kernel/ps/sched.c \
|
||||
kernel/init/info.c kernel/init/ssp.c \
|
||||
kernel/io/rtc.c kernel/io/keyb.c \
|
||||
kernel/io/spkr.c kernel/po/shtdwn.c
|
||||
kernel/io/spkr.c kernel/po/shtdwn.c \
|
||||
kernel/ke/shell.c
|
||||
|
||||
LibCObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(LibCSources))
|
||||
|
||||
|
@ -22,45 +22,13 @@
|
||||
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <extras/buf.h>
|
||||
#include <kernel/iomisc.h>
|
||||
#include <kernel/cursor.h>
|
||||
#include <kernel/mboot.h>
|
||||
#include <kernel/heap.h>
|
||||
#include <kernel/mm.h>
|
||||
#include <kernel/time.h>
|
||||
#include <kernel/speaker.h>
|
||||
#include <kernel/pwmgnt.h>
|
||||
|
||||
// info.c
|
||||
extern void BtDoSanityChecks(uint mbMagic);
|
||||
extern void BtInitBootInfo(multiboot_info_t *mbi, void *codeSeg);
|
||||
|
||||
// io/vga.c
|
||||
extern error_t IoInitVGABuffer(void);
|
||||
extern void IoScrollDown(void);
|
||||
extern void IoScrollUp(void);
|
||||
|
||||
// io/keyb.c
|
||||
extern void IoEnableKeyb(void);
|
||||
|
||||
// cpu/idt.c
|
||||
extern void IdtSetup(void);
|
||||
|
||||
// ps/proc.c test function
|
||||
extern void pstest(void);
|
||||
|
||||
// interrupts tests
|
||||
extern void divideByZero(void);
|
||||
#include "init.h"
|
||||
|
||||
//
|
||||
// Entry point of the Kaleid kernel
|
||||
//
|
||||
noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
||||
{
|
||||
uchar ch;
|
||||
error_t rc;
|
||||
|
||||
KeDisableIRQs();
|
||||
|
||||
// Initialize the BootInfo_t structure
|
||||
@ -94,34 +62,7 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
||||
IoGetRtcTimeChar();
|
||||
IoPrintRtcTime();
|
||||
|
||||
int i=0;
|
||||
while(i++<50)KernLog("%d\n", i);
|
||||
|
||||
// Main loop
|
||||
while ((rc = bgetc(BStdIn, &ch)) == EOK) {
|
||||
switch (ch) {
|
||||
|
||||
case 7: // BEL
|
||||
if (rand() % 32 == 0) {
|
||||
IoDoStarWars();
|
||||
}
|
||||
else IoDoBeep();
|
||||
break;
|
||||
|
||||
case 17: // DC1
|
||||
IoScrollUp();
|
||||
break;
|
||||
|
||||
case 18: // DC2
|
||||
IoScrollDown();
|
||||
break;
|
||||
|
||||
case 27: // ESC
|
||||
BFlushBuf(BStdOut);
|
||||
PoShutdownQemu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
KeStartShell();
|
||||
|
||||
KernLog("End of input reached\n");
|
||||
PoShutdownQemu();
|
||||
|
56
kaleid/kernel/init/init.h
Normal file
56
kaleid/kernel/init/init.h
Normal file
@ -0,0 +1,56 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// GNU GPL OS/K //
|
||||
// //
|
||||
// Desc: Kernel entry point //
|
||||
// //
|
||||
// //
|
||||
// Copyright © 2018-2019 The OS/K Team //
|
||||
// //
|
||||
// This file is part of OS/K. //
|
||||
// //
|
||||
// OS/K is free software: you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation, either version 3 of the License, or //
|
||||
// any later version. //
|
||||
// //
|
||||
// OS/K is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <extras/buf.h>
|
||||
#include <kernel/iomisc.h>
|
||||
#include <kernel/cursor.h>
|
||||
#include <kernel/mboot.h>
|
||||
#include <kernel/heap.h>
|
||||
#include <kernel/mm.h>
|
||||
#include <kernel/time.h>
|
||||
#include <kernel/speaker.h>
|
||||
#include <kernel/pwmgnt.h>
|
||||
|
||||
// info.c
|
||||
extern void BtDoSanityChecks(uint mbMagic);
|
||||
extern void BtInitBootInfo(multiboot_info_t *mbi, void *codeSeg);
|
||||
|
||||
// io/vga.c
|
||||
extern error_t IoInitVGABuffer(void);
|
||||
|
||||
// ke/shell.c
|
||||
extern void KeStartShell(void);
|
||||
|
||||
// io/keyb.c
|
||||
extern void IoEnableKeyb(void);
|
||||
|
||||
// cpu/idt.c
|
||||
extern void IdtSetup(void);
|
||||
|
||||
// ps/proc.c test function
|
||||
extern void pstest(void);
|
||||
|
||||
// interrupts tests
|
||||
extern void divideByZero(void);
|
||||
|
@ -26,12 +26,15 @@
|
||||
#include <kernel/iomisc.h>
|
||||
#include <extras/buf.h>
|
||||
|
||||
char ScanCodes[100] = { 0 };
|
||||
static char ScanCodes[100] = { 0 };
|
||||
static char Invisible[100] = { 0 };
|
||||
|
||||
void KeybPrint(char code)
|
||||
{
|
||||
bputc(BStdIn, ScanCodes[(int)code]);
|
||||
if (code && (isprint(ScanCodes[(int)code]) || ScanCodes[(int)code]=='\n')) {
|
||||
uchar ch = ScanCodes[(int)code];
|
||||
|
||||
bputc(BStdIn, ch);
|
||||
if (code && Invisible[(int)code] == 0) {
|
||||
bputc(BStdOut, ScanCodes[(int)code]);
|
||||
//bprintf(BStdOut, "%x ", code);
|
||||
BStdOut->flusher(BStdOut);
|
||||
@ -41,6 +44,7 @@ void KeybPrint(char code)
|
||||
void ScanCodesInit(void)
|
||||
{
|
||||
ScanCodes[0x01] = 27; // ESC
|
||||
Invisible[0x01] = 1;
|
||||
ScanCodes[0x02] = '1';
|
||||
ScanCodes[0x03] = '2';
|
||||
ScanCodes[0x04] = '3';
|
||||
@ -97,12 +101,17 @@ void ScanCodesInit(void)
|
||||
ScanCodes[0x39] = ' ';
|
||||
|
||||
ScanCodes[0x40] = 7; // BEL
|
||||
Invisible[0x40] = 1;
|
||||
|
||||
// Numpad
|
||||
ScanCodes[0x48] = 17; // DC1, will serve as Arrow Up
|
||||
ScanCodes[0x50] = 18; // DC2, will serve as Arrow Down
|
||||
ScanCodes[0x4B] = 19; // DC3, will serve as Arrow Left
|
||||
ScanCodes[0x4D] = 20; // DC4, will serve as Arrow Right
|
||||
Invisible[0x48] = 1;
|
||||
Invisible[0x50] = 1;
|
||||
Invisible[0x4B] = 1;
|
||||
Invisible[0x4D] = 1;
|
||||
}
|
||||
|
||||
void KeybHandler(ISRFrame_t *regs)
|
||||
|
63
kaleid/kernel/ke/shell.c
Normal file
63
kaleid/kernel/ke/shell.c
Normal file
@ -0,0 +1,63 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// GNU GPL OS/K //
|
||||
// //
|
||||
// Desc: Kernel "shell" entry point //
|
||||
// //
|
||||
// //
|
||||
// Copyright © 2018-2019 The OS/K Team //
|
||||
// //
|
||||
// This file is part of OS/K. //
|
||||
// //
|
||||
// OS/K is free software: you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation, either version 3 of the License, or //
|
||||
// any later version. //
|
||||
// //
|
||||
// OS/K is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <extras/buf.h>
|
||||
#include <kernel/time.h>
|
||||
#include <kernel/speaker.h>
|
||||
#include <kernel/pwmgnt.h>
|
||||
|
||||
extern void IoScrollDown(void);
|
||||
extern void IoScrollUp(void);
|
||||
|
||||
void KeStartShell(void)
|
||||
{
|
||||
uchar ch;
|
||||
error_t rc;
|
||||
|
||||
while ((rc = bgetc(BStdIn, &ch)) == EOK) {
|
||||
switch (ch) {
|
||||
|
||||
case 7: // BEL
|
||||
if (rand() % 64 == 0) {
|
||||
IoDoStarWars();
|
||||
}
|
||||
else IoDoBeep();
|
||||
break;
|
||||
|
||||
case 17: // DC1
|
||||
IoScrollUp();
|
||||
break;
|
||||
|
||||
case 18: // DC2
|
||||
IoScrollDown();
|
||||
break;
|
||||
|
||||
case 27: // ESC
|
||||
BFlushBuf(BStdOut);
|
||||
PoShutdownQemu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user