Resolved #76...

This commit is contained in:
Adrien Bourmault 2020-01-08 21:10:24 +01:00
parent 737bea025f
commit 6785767528
4 changed files with 13 additions and 17 deletions

View File

@ -41,7 +41,7 @@ CCNAME=x86_64-elf-gcc
ASMFLAGS=-f elf64 ASMFLAGS=-f elf64
LDFLAGS=-melf_x86_64 LDFLAGS=-melf_x86_64
COPTIM=-O2 COPTIM=-O2
CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type -Wpadded CWARNS=-Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Werror=implicit-function-declaration -Werror=return-type #-Wpadded
CINCLUDES=-Iinclude CINCLUDES=-Iinclude
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-all -fdump-rtl-expand CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -fstack-protector-all -fdump-rtl-expand
CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2 CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2

View File

@ -31,17 +31,17 @@
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
void IoStartSpeaker(int); void IoStartSpeaker(ulong);
void IoDoBeep(void); void IoDoBeep(void);
void IoDoTone(uint tone, uint time); void IoDoTone(ulong tone, ulong time);
void IoDoBeepNoIdt(void); void IoDoBeepNoIdt(void);
void IoDoStarWars(void); void IoDoStarWars(void);
struct Note struct Note
{ {
uint tone; ulong tone;
uint time; ulong time;
}; };
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//

View File

@ -28,7 +28,7 @@
extern bool KeIdtIsInitialized; extern bool KeIdtIsInitialized;
const struct Note score[40] = { {440, 200}, {110, 200}, {440, 200}, {110, 200}, struct Note score[40] = { {440, 200}, {110, 200}, {440, 200}, {110, 200},
{440, 200}, {110, 200}, {349, 140}, {87, 100}, {440, 200}, {110, 200}, {349, 140}, {87, 100},
{523, 60}, {87, 100}, {440, 200}, {110, 200}, {523, 60}, {87, 100}, {440, 200}, {110, 200},
{349, 140}, {87, 100}, {523, 60}, {87, 100}, {349, 140}, {87, 100}, {523, 60}, {87, 100},
@ -37,13 +37,12 @@ const struct Note score[40] = { {440, 200}, {110, 200}, {440, 200}, {110, 200},
{659, 200}, {87, 200}, {698, 140}, {87, 100}, {659, 200}, {87, 200}, {698, 140}, {87, 100},
{523, 60}, {87, 100}, {415, 200}, {87, 200}, {523, 60}, {87, 100}, {415, 200}, {87, 200},
{349, 140}, {87, 100}, {523, 60}, {87, 100}, {349, 140}, {87, 100}, {523, 60}, {87, 100},
{440, 200}, {110, 200}, {110, 200}, {110, 200} {440, 200}, {110, 200}, {110, 200}, {110, 200} };
};
void IoStartSpeaker(int freq) void IoStartSpeaker(ulong freq)
{ {
uchar temp; uchar temp;
uint pitf = 1193180 / freq; ulong pitf = 1193180 / freq;
ulong flags = KePauseIRQs(); ulong flags = KePauseIRQs();
IoWriteByteOnPort(0x43, 0xB6); IoWriteByteOnPort(0x43, 0xB6);
@ -64,13 +63,13 @@ static inline void IoQuietSpeaker(void)
KeRestoreIRQs(flags); KeRestoreIRQs(flags);
} }
void IoDoTone(uint tone, uint time) void IoDoTone(ulong tone, ulong time)
{ {
IoStartSpeaker(tone); IoStartSpeaker(tone);
KeSleep(time); KeSleep(time);
} }
static void IoDoToneNoIdt(uint tone, uint time) static void IoDoToneNoIdt(ulong tone, ulong time)
{ {
extern void temporize(void); extern void temporize(void);
IoStartSpeaker(tone); IoStartSpeaker(tone);
@ -94,10 +93,7 @@ void IoDoBeepNoIdt(void)
void IoDoStarWars(void) void IoDoStarWars(void)
{ {
for (uint i = 0; i < 40; i++) { for (uint i = 0; i < 40; i++) {
//IoDoTone(score[i].tone, score[i].time); IoDoTone(score[i].tone, score[i].time);
bprintf(BStdOut, "At %p : %u\n", &(score[i].tone), score[i].tone);
bprintf(BStdOut, "At %p : %u\n", &(score[i].time), score[i].time);
BStdOut->flusher(BStdOut);
} }
IoQuietSpeaker(); IoQuietSpeaker();