mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
BEEEEP
This commit is contained in:
parent
c55c45f1f9
commit
6e295c23e3
11
Makefile
11
Makefile
@ -94,7 +94,8 @@ KernSources = libbuf/buf.c libbuf/bputc.c libbuf/bscroll.c \
|
||||
kernel/mm/heap.c kernel/mm/malloc.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/rtc.c kernel/io/keyb.c \
|
||||
kernel/io/spkr.c
|
||||
|
||||
LibCObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(LibCSources))
|
||||
|
||||
@ -156,20 +157,20 @@ $(KOBJDIR)/%.o: %.c $(INCLUDEDIR)/*/*.h | $(KOBJDIR)
|
||||
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
|
||||
|
||||
test: all
|
||||
@qemu-system-x86_64 -rtc base=localtime -m 4G -hda $(BUILDDIR)/bin/disk.img \
|
||||
@qemu-system-x86_64 -rtc base=localtime -m 4G -hda $(BUILDDIR)/bin/disk.img -soundhw pcspk \
|
||||
-d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||
|
||||
test32: all
|
||||
@qemu-system-i386 -hda $(BUILDDIR)/bin/disk.img -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||
|
||||
debug: all
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot -soundhw pcspk \
|
||||
-no-shutdown -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log &
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > $(BUILDDIR)/kaleid64_disasm.asm
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > $(BUILDDIR)/kaleid32_disasm.asm
|
||||
|
||||
gdb: all
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot -soundhw pcspk \
|
||||
-no-shutdown -d cpu_reset,guest_errors,pcall,int -s -S 2> $(BUILDDIR)/qemu.log &
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > kaleid64_disasm.asm
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm
|
||||
@ -180,7 +181,7 @@ gdb: all
|
||||
-ex "break BtStartKern" \
|
||||
|
||||
ddd: all
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot \
|
||||
@qemu-system-x86_64 -m 64M -hda $(BUILDDIR)/bin/disk.img -no-reboot -soundhw pcspk \
|
||||
-no-shutdown -d cpu_reset,guest_errors,pcall,int -s -S 2> $(BUILDDIR)/qemu.log &
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > kaleid64_disasm.asm
|
||||
@ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm
|
||||
|
@ -101,14 +101,14 @@ struct Processor_t
|
||||
};
|
||||
|
||||
struct ISRFrame_t {
|
||||
/* the register file */
|
||||
/* The register file */
|
||||
ulong regs[15];
|
||||
|
||||
/* the error code and interrupt id */
|
||||
/* The error code and interrupt id */
|
||||
ulong intNo;
|
||||
ulong ErrorCode;
|
||||
|
||||
/* these are pushed automatically by the CPU */
|
||||
/* These are pushed automatically by the CPU */
|
||||
ulong rip;
|
||||
ulong cs;
|
||||
ulong rflags;
|
||||
|
41
include/kernel/speaker.h
Normal file
41
include/kernel/speaker.h
Normal file
@ -0,0 +1,41 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// GNU GPL OS/K //
|
||||
// //
|
||||
// Desc: Speaker functions //
|
||||
// //
|
||||
// //
|
||||
// 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/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef _KALKERN_BASE_H
|
||||
#include <kernel/base.h>
|
||||
#endif
|
||||
|
||||
#ifndef _KALKERN_SPEAKER_H
|
||||
#define _KALKERN_SPEAKER_H
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
void IoStartSpeaker(int freq);
|
||||
void IoQuietSpeaker(void);
|
||||
void IoDoBeep(void);
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,15 @@
|
||||
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef _KALKERN_BASE_H
|
||||
#include <kernel/base.h>
|
||||
#endif
|
||||
|
||||
#ifndef _KALKERN_TIME_H
|
||||
#define _KALKERN_TIME_H
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uchar sec;
|
||||
@ -42,3 +51,7 @@ extern Time_t* IoGetRtcTime(void);
|
||||
extern char* IoGetRtcTimeChar(void);
|
||||
//static char* WeekDays[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <kernel/heap.h>
|
||||
#include <kernel/mm.h>
|
||||
#include <kernel/time.h>
|
||||
#include <kernel/speaker.h>
|
||||
|
||||
// info.c
|
||||
extern void BtDoSanityChecks(uint mbMagic);
|
||||
@ -94,7 +95,9 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
||||
/* i++; */
|
||||
/* } */
|
||||
|
||||
KernLog("Goodbye at %s", IoGetRtcTimeChar());
|
||||
KernLog("Goodbye at %s\n", IoGetRtcTimeChar());
|
||||
|
||||
IoDoBeep();
|
||||
|
||||
// End this machine's suffering
|
||||
BStdOut->flusher(BStdOut);
|
||||
|
60
kaleid/kernel/io/spkr.c
Normal file
60
kaleid/kernel/io/spkr.c
Normal file
@ -0,0 +1,60 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// GNU GPL OS/K //
|
||||
// //
|
||||
// Desc: Speaker functions //
|
||||
// //
|
||||
// //
|
||||
// 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 <kernel/speaker.h>
|
||||
#include <kernel/iomisc.h>
|
||||
#include <kernel/time.h>
|
||||
|
||||
void IoStartSpeaker(int freq)
|
||||
{
|
||||
char temp;
|
||||
int pitf = 1193180 / freq;
|
||||
|
||||
IoWriteByteOnPort(0x43, 0xB6);
|
||||
IoWriteByteOnPort(0x42, (char)pitf);
|
||||
IoWriteByteOnPort(0x42, (char)(pitf >> 8));
|
||||
|
||||
temp = IoReadByteFromPort(0x61);
|
||||
if (temp != (temp | 3)) {
|
||||
IoWriteByteOnPort(0x61, temp | 3);
|
||||
}
|
||||
}
|
||||
|
||||
void IoQuietSpeaker(void)
|
||||
{
|
||||
IoWriteByteOnPort(0x61, IoReadByteFromPort(0x61) & 0xFC);
|
||||
}
|
||||
|
||||
void IoDoBeep(void)
|
||||
{
|
||||
IoStartSpeaker(1000);
|
||||
|
||||
// Worst possible way of waiting
|
||||
// We need actual timers
|
||||
ulong ticks = IoGetRtcTicks();
|
||||
while (IoGetRtcTicks() < ticks + 512);
|
||||
|
||||
IoQuietSpeaker();
|
||||
}
|
||||
|
@ -372,8 +372,6 @@ void PrintList(ListHead_t *head)
|
||||
|
||||
void pstest(void)
|
||||
{
|
||||
//ClearTerm(StdOut);
|
||||
|
||||
KernLog("\nTime Critical: ");
|
||||
PrintList(TimeCritProcs);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user