Error with march (speaker) corrected

This commit is contained in:
Adrien Bourmault 2019-11-26 17:23:55 +01:00
parent 313c69a05b
commit f844ed86a0
4 changed files with 41 additions and 10 deletions

View File

@ -194,6 +194,11 @@ $(KOBJDIR)/kernel/ke/cpuid.o: $(KALEIDDIR)/kernel/ke/cpuid.c \
@rm -f $@.1 $@.2
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/ke/shcmds.o: $(KALEIDDIR)/kernel/sh/shcmds.c | $(KOBJDIR)
@mkdir -p $(shell dirname $@)
@$(KCC_MATHS) -MM -MT $(@:%.d=%.o) -MF $@ $<
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/mm/paging.o: $(KALEIDDIR)/kernel/mm/paging.c \
$(KALEIDDIR)/kernel/mm/paging.asm | $(KOBJDIR)
@mkdir -p $(shell dirname $@)

View File

@ -32,7 +32,6 @@
//----------------------------------------------------------------------------//
void IoStartSpeaker(int);
void IoQuietSpeaker(void);
void IoDoBeep(void);
void IoDoTone(uint tone, uint time);
void IoDoBeepNoIdt(void);

View File

@ -24,6 +24,7 @@
#include <io/spkr.h>
#include <ke/time.h>
#include <lib/buf.h>
extern bool KeIdtIsInitialized;
@ -44,7 +45,7 @@ void IoStartSpeaker(int freq)
KeRestoreIRQs(flags);
}
void IoQuietSpeaker(void)
static inline void IoQuietSpeaker(void)
{
ulong flags = KePauseIRQs();
IoWriteByteOnPort(0x61, IoReadByteFromPort(0x61) & 0xFC);
@ -54,8 +55,7 @@ void IoQuietSpeaker(void)
void IoDoTone(uint tone, uint time)
{
IoStartSpeaker(tone);
KeDelayExecution(time);
IoQuietSpeaker();
KeSleep(time);
}
static void IoDoToneNoIdt(uint tone, uint time)
@ -79,8 +79,6 @@ void IoDoBeepNoIdt(void)
void IoDoStarWars(void)
{
size_t i;
struct Note {
uint tone;
uint time;
@ -91,7 +89,6 @@ void IoDoStarWars(void)
{523, 60}, {87, 100}, {440, 200}, {110, 200},
{349, 140}, {87, 100}, {523, 60}, {87, 100},
{440, 200}, {110, 200}, {440, 200}, {110, 200},
{659, 200}, {110, 200}, {659, 200}, {110, 200},
{659, 200}, {87, 200}, {698, 140}, {87, 100},
{523, 60}, {87, 100}, {415, 200}, {87, 200},
@ -99,7 +96,14 @@ void IoDoStarWars(void)
{440, 200}, {110, 200}, {110, 200}, {110, 200}
};
for (i = 0; i < sizeof(score)/sizeof(struct Note); i++) {
//bprintf(BStdOut, "\n");
for (uint i = 0; i < sizeof(score)/sizeof(struct Note); i++) {
IoDoTone(score[i].tone, score[i].time);
//bprintf(BStdOut, "%d ", i);
//BStdOut->flusher(BStdOut);
}
IoQuietSpeaker();
//bprintf(BStdOut, "FINISHED\n");
}

View File

@ -164,6 +164,28 @@ error_t CmdDumpATASect(int argc, char **argv, char *cmdline)
return EOK;
}
error_t CmdFloat(int argc, char **argv, char *cmdline)
{
double param = (double)ShAtoi(argv[1]);
double b = 138899.009 / (14.9); //9322,0811409
double b_ent = (double)(ulong)b;
double dec = 0.0;
KernLog("int(b) = %d \n", (ulong)b_ent);
KernLog("dec(b) = ");
for(double i = 0; i < param; i++) {
dec = (((b*param) - (b_ent*param)) * 10.0 * i / param);
KernLog("%d", (ulong)dec);
}
KernLog("\n");
return EOK;
}
error_t CmdHelp(int argc, char **argv, char *cmdline)
{
uint i, count = 0;
@ -338,8 +360,9 @@ static Command_t testcmdtable[] =
{ "args", CmdArgs, "Print command line" },
{ "dmpsec", CmdDumpATASect, "Dump an ATA sector on screen" },
{ "help", CmdHelpTest, "Show this message" },
{ "pfault", CmdPF, "Provoke a PF. Usage: pfault <address>"},
{ "pstest", CmdPsTest, "Scheduler test routine" },
{ "pf", CmdPF, "Provoke a PF. Usage: pfault <address>"},
{ "ps", CmdPsTest, "Scheduler test routine" },
{ "float", CmdFloat, "Float test" },
{ "rpag", CmdReloadPage, "Reload the pages directory" },
{ "shell", CmdShell, "Start a new shell (nested)", },
{ "stkov", CmdStackOverflow, "Provoke a stack overflow" },